views:

72

answers:

1

I'm new to OpenCV and image processing in general. I have photos taken with a camera of food labels for a project I'm working on. I was able to use the cvHoughLines2 function to draw red lines over the lines/bars on the photo.

What I want to do now is to chop up the image into several smaller images based on the Hough lines - so that each "line" (e.g. the "calories" line, "protein" line, etc) of the food label is separated into new images.

Since I have no idea how to do this, is there someone who could point me somewhere or teach me how to do this?

Thanks.

A: 

As far as I know, there are no functions that split an image into multiple parts. You'll have to set an ROI (region of interest), create a new image of smaller size, and then copy that image into the smaller image.

Have a look at http://aishack.in/ it has OpenCV tutorials... some of them might help you

Utkarsh Sinha
Thanks, I will look into ROIs. Another question -- do you know of a more accurate way to find lines than Hough transform? I've noticed that some of the "lines" reported by HoughLines aren't actually the ones I'm looking for. Any suggestions?
ahanda10
I'm not sure of any other way of finding lines... but I think hough is good enough. The accuracy of a hough transform depends on the threshold value you set and the precision you take for the accumulator array. Try playing around with those two and you should have proper lines detected
Utkarsh Sinha