Ask Your Question
1

Line detection and timestamps, video, Python

asked 2012-07-27 05:56:46 -0600

Kea gravatar image

I am working on a scientific project. I am trying to figure out how to calculate the melting speed of ice cores by use of OpenCv and Python. The ice cores melt downwards.

To simplify the problem I would like first to detect pencil lines (5 cm between each of them) on a piece of paper that is moving downwards. Every time a line passes a certain point, a timestamp must be made and send to a log file.From that information the speed will be calculated. Later the lines will be made on the ice cores.

I need to get started, so I have looked at the sample files that come with the OpenCV library, and I found the facedetect.py example. Could this sample be uses and adjusted to detect lines instead of faces? Or is there a better sample to look at?

Thank you!

edit retag flag offensive close merge delete

Comments

2

If you post some pictures of your melting ice, you have a much better chance to find ideas. And about lines, they are usually easily detected with Hough Transform. See the hough.cpp sample

sammy gravatar imagesammy ( 2012-07-27 08:56:56 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
2

answered 2012-07-28 03:48:04 -0600

Kirill Kornyakov gravatar image

updated 2012-07-28 03:49:08 -0600

Lines and faces are completely different objects, so you shouldn't count on facedetect.py. Try to start from the Hough transform. You can grep OpenCV C/C++ samples for this function, there should be some useful code samples.

HoughLines should be a perfect function for pencils on paper, but melting ice will produce curves, not strict edges. Nevertheless you can start with this function, and switch later to tracking with Optical Flow or something. You can put several dozens of points to every edge, and then track how they move down. But you should constrain the Optical Flow in a way so it searches for new points' positions in the vertical direction only. If the ice is melting slowly, you can even implement your own search with a block-matching-like technique.

edit flag offensive delete link more

Comments

Thanks a lot! I will look at it.

Kea gravatar imageKea ( 2012-07-28 06:33:50 -0600 )edit
0

answered 2013-03-15 15:26:19 -0600

MS gravatar image

If your paper background is quite plain, you can do some simple binary thresholding to get the pencil lines. Then projecting the lines onto the y axis and doing a min for a range will give you the lowest point of a particular pencil line and you can set some predefined points in y that you are looking for to be logged. Whenever the min(projection(y)) is lower than your predefined line, you trigger the rest of the code. However the assumption is that the various pencil lines do not overlap in the projection space.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-07-27 05:56:46 -0600

Seen: 2,286 times

Last updated: Mar 15 '13