Ask Your Question

tyler.royer's profile - activity

2016-09-13 11:07:40 -0600 received badge  Supporter (source)
2016-09-13 08:08:29 -0600 commented answer contour detection and distance measurement

Okay, so I figured out the above issue.

for stat in stats:
    (l,t,w,h,a) = stat
    print(a)
    tl = (l,t)
    br = (l+w,t+h)
    cv2.rectangle(img,tl,br,(0,255,0),3)

This draws the rectangle around all the components, using the area I can limit the components to only be the fiber and the reference.

2016-09-13 07:50:43 -0600 commented answer contour detection and distance measurement

You're assumptions are accurate.Thank you for your help.

I am using python and the documentation for 3.1.0 does not have a python example only c++

output = cv2.connectedComponentsWithStats(thresh, 4, cv2.CV_32S)
# Get the results
# The first cell is the number of labels
num_labels = output[0]
# The second cell is the label matrix
labels = output[1]
# The third cell is the stat matrix
stats = output[2]
# The fourth cell is the centroid matrix
centroids = output[3]

This is what I have, and I'm not exactly sure how to print out the bounding boxes.

2016-09-12 15:20:00 -0600 asked a question contour detection and distance measurement

Hi

I am trying to find the distance between an optical fiber and a reference plane.

The code I am using sees the external profile of the fiber but only generates a small contour around it and only find the flat metal surface in the top right.

The end of the fiber is match headed in this example, in most cases it will be a flat edge.

TL;DR I want to generate a rectangle around the fiber and measure the distance to the reference surface. I know how to do the distance measurement, getting the polygon around the fiber and detecting the reference surface is my issue.

The image comes from a live camera feed, where the fiber does not exist and the reference plane can float in direction a good bit but generally looks like the image below

image description

2016-09-01 06:31:11 -0600 commented answer ToupCam VideoCapture Not Working

Sorry if it was confusing. I was saying that the built in webcam on my laptop works. However the USB 2.0 Camera I would like to use does not work.

The USB 2.0 Camera is a ToupTek camera and is currently using their driver

Hangzhou ToupTek Photonics Co., Ltd; http://www.touptek.com/

It is a UCMOS camera if that makes any sense. I am not completely sure how to use the CMake build, I am only using the precompiled version.

2016-08-31 08:19:40 -0600 asked a question ToupCam VideoCapture Not Working

I am trying to get a microscope camera to work with opencv, my webcam works when using VideoCapture(0) and -1.

However the microscope camera I am using, OMAX A35140U (ToupCam), will not work when using any other numbers. It does show up as a connected camera when viewing devices (USB 2.0 Camera). I am using python and windows 7 pro.

Any help would be great. Thank you.