Ask Your Question

Sujit Baranwal's profile - activity

2016-03-02 20:57:02 -0600 received badge  Enthusiast
2016-03-01 22:51:40 -0600 commented question Scan and find the length and breadth of object from iPhone camera

I'm not quite sure what the question you're asking is

There is hydraulic part that you can see in the above image, now we have to find the length, breadth and outside diameter of that hydraulic part.

What image are you trying to separate the black and white pixels on?

So, the approach is to convert above image into grayscale and separate the pixels of the object displayed in above image.

Did you already try to use the threshold function?

Regards to threshold function, I think I am using Harris Edge detection algorithm so it is already applied.

That turns the image into a binary image with only black and white pixels.

My concern is that if I used threshold function that you mention, my complete image turns into black color.

2016-03-01 00:11:45 -0600 asked a question Scan and find the length and breadth of object from iPhone camera

I want to find the length, breadth and outside diameter of the object

My analysis so far:

Applied the multiple algorithms like Canny and Sobel to detect the edges of the object.

I converted a image into Matrix Array:

//Function that convert image to matrix array. - (cv::Mat)cvMatFromUIImage:(UIImage *)image { CGColorSpaceRef colorSpace = CGImageGetColorSpace(image.CGImage); CGFloat cols = image.size.width; CGFloat rows = image.size.height;

cv::Mat cvMat(rows, cols, CV_8UC4); // 8 bits per component, 4 channels (color channels + alpha)

CGContextRef contextRef = CGBitmapContextCreate(cvMat.data,                 // Pointer to  data
                                                cols,                       // Width of bitmap
                                                rows,                       // Height of bitmap
                                                8,                          // Bits per component
                                                cvMat.step[0],              // Bytes per row
                                                colorSpace,                 // Colorspace
                                                kCGImageAlphaNoneSkipLast |
                                                kCGBitmapByteOrderDefault); // Bitmap info flags

CGContextDrawImage(contextRef, CGRectMake(0, 0, cols, rows), image.CGImage);
CGContextRelease(contextRef);

return cvMat;

}

//Use function to create a matrix object.

cv::Mat cvImage = [self cvMatFromUIImage:image];

Then I apply the canny:

cv::Canny(grayImage, edges, m_cannyLoThreshold, m_cannyHiThreshold, m_cannyAperture * 2 + 1);

Same way I applied Sobel algorithm as well:

int scale = 1;
int delta = 0;
int ddepth = CV_16S;

/// Gradient X
cv::Sobel( grayImage, grad_x, ddepth, 1, 0, 3, scale, delta, cv::BORDER_DEFAULT );   
cv::convertScaleAbs( grad_x, abs_grad_x );

/// Gradient Y  
cv::Sobel( grayImage, grad_y, ddepth, 0, 1, 3, scale, delta, cv::BORDER_DEFAULT );   
cv::convertScaleAbs( grad_y, abs_grad_y );

/// Total Gradient (approximate)
cv::addWeighted( abs_grad_x, 0.5, abs_grad_y, 0.5, 0, edges );

Now, I am separating the black and white pixels on the image. But every pixels that is looking black on device return some other pixel color.

What I have to do, separating the pixels from the image so that I get the actual height and width of object in image. Any suggestion ?

I have to detect the object in below image.image description

2016-02-23 02:17:18 -0600 commented question detect hydraulic part from iPhone camera

Okay, so far I tried to use open CV framework to identify this part over the iPhone camera, I got success to figure out some of the shapes like Square, Triangle, but as this is the cylinder as a result I am not getting this object, any suggestion that you want me to give will definitely try.

2016-02-23 00:31:30 -0600 asked a question detect hydraulic part from iPhone camera

I want to detect hydraulic part from the iPhone camera and find 4 major thing: image description 1) Length 2) Breadth 3) Height 4) Diameter 5) Thread per inch.

Any Suggestion. Thanks in advance.image description