how to detect whether tube is present of not??
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.
Is there any suggestions ?? please guide me!! Thank you very much in advance.
may be you can make a difference between a reference background and your new image
or detecting vertical (long) lines?
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.
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.
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.
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
You can print by
std::cout
in C++, orprint
in Python. (standard console). If you want to display on the image then you should use putTextI 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.
Have you tried absdiff?
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.