Ask Your Question
0

how to detect whether tube is present of not??

asked 2015-07-15 05:38:56 -0600

Akki gravatar image

updated 2015-07-30 12:45:28 -0600

pklab gravatar image

Hello,

I want to detect that tube is in frame of not. currently I am using canny edge detection, but problem is how can i set edge for tube. So, I can get information that tube is there or not. as shown in picture, there is tube and its edge can be easily identified

Is there any suggestions ?? please guide me!! Thank you very much in advance.

edit retag flag offensive close merge delete

Comments

2

may be you can make a difference between a reference background and your new image

LBerger gravatar imageLBerger ( 2015-07-15 05:56:59 -0600 )edit

or detecting vertical (long) lines?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-15 06:04:49 -0600 )edit

thank you for your suggestion. difference between reference background means image without tube and image with tube and find difference like this or something else?? and can you give me some idea about how to filter horizontal line so i can detect vertical line..

Thank you very much once again for your suggestions.

Akki gravatar imageAkki ( 2015-07-15 06:20:58 -0600 )edit
1

I suppose that differences between the images with and without tube may be influenced by lights, so maybe using some preprocessing first (not sure exactly what). For detecting vertical lines, you can use HoughLines, for example, and if the line is longer than a third of the image height, then you have a tube. For vertical lines, you need to filter the detected lines by theta, and then by size, so no mistakes because of small objects. Now you have a detector if one tube at least is present.

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-15 06:53:20 -0600 )edit

Thanks for suggestions first I am trying with to difference between a reference background and new image, I used, Mat result1 = abs(bg-frame); to subtract the ideal image from the new image. But I am confused that how can I print out the message that image is matched or image is not matched. is there any suggestions regarding to this??

Thank you very much for suggestions and time.

Akki gravatar imageAkki ( 2015-07-17 02:29:29 -0600 )edit

When you 've got difference you can use threshold with a thresh equal to small value like 5 ( must be greater than camera noise). Of course in a first step lights must be same. When it works you can think about light condition

LBerger gravatar imageLBerger ( 2015-07-17 02:53:52 -0600 )edit

You can print by std::cout in C++, or print in Python. (standard console). If you want to display on the image then you should use putText

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-17 02:55:10 -0600 )edit

I tried to find solution but still i haven't got the solution, how to display when image is not similar,

Mat frame= imread("C:/Users/ankit/Desktop/test/new system/12.2.png",1);

cvtColor( frame, frame, CV_RGB2GRAY ); imshow ("original", frame);

Mat bg = imread("C:/Users/ankit/Desktop/test/new system/12.2.A.png",1); bg = bg(Rect (55, 23,803, 562));

cvtColor( bg, bg, CV_RGB2GRAY ); imshow("standard image", bg);

Mat result1 = abs(bg-frame); imshow("withoutMask.tif",result1);

please guide me if there is any example code. thank you very much for your suggestions.

Akki gravatar imageAkki ( 2015-07-20 02:29:08 -0600 )edit

Have you tried absdiff?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-21 03:37:18 -0600 )edit

thank you for suggestion. I tried with absdiff. program works fine for moment. means I am getting difference between two images. but I want to do print the message like when image is same then cout << "same " or in case of different it should be print message like image are different.

Akki gravatar imageAkki ( 2015-07-21 05:28:05 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2015-07-30 12:26:23 -0600

pklab gravatar image

Your question is duplicated here . Again: Vertical Sobel than horiz scan your binarized image and search for vertical edges. Remember to setup a good light/background in favor of detection if it's possible.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-07-15 05:38:56 -0600

Seen: 943 times

Last updated: Jul 30 '15