ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I don't usually use Python, but in C++ we have an imwrite function in openCV. I just googled it and it seems to be there for opencv too.

Try:

cv2.imwrite(FileName, cv_image)

I don't usually use Python, but in C++ we have an imwrite function in openCV. I just googled it and it seems to be there for opencv too.

Try:

cv2.imwrite(FileName, cv_image)

As for your code, I don't see a (non commented) while loop anywhere in your edited posts. Have you tried:

while (click < 10):
    h,w=cv_image.shape
    bitmap=cv2.cv.CreateImage((w,h), cv2.cv.IPL_DEPTH_16S, 1)
    cv2.cv.SaveImage('image'+str(click)+'.jpg',bitmap)
    click=click+1   
    #time.sleep(3)

I assume you have. Just double checking.

I don't usually use Python, but in C++ we have an imwrite function in openCV. I just googled it and it seems to be there for opencv for python too.

Try:

cv2.imwrite(FileName, cv_image)

As for your code, I don't see a (non commented) while loop anywhere in your edited posts. Have you tried:

while (click < 10):
    h,w=cv_image.shape
    bitmap=cv2.cv.CreateImage((w,h), cv2.cv.IPL_DEPTH_16S, 1)
    cv2.cv.SaveImage('image'+str(click)+'.jpg',bitmap)
    click=click+1   
    #time.sleep(3)

I assume you have. Just double checking.

I don't usually use Python, but in C++ we have an imwrite function in openCV. I just googled it and it seems to be there for opencv for python too.

Try:

cv2.imwrite(FileName, cv_image)

As for your code, I don't see a (non commented) while loop anywhere in your edited posts. Have you tried: Considering you want to do it every time you click, your code should look like this:

while (click click < 10):
10:
    c=cv2.waitKey(10)
    if c != 10
            break
    h,w=cv_image.shape
    bitmap=cv2.cv.CreateImage((w,h), cv2.cv.IPL_DEPTH_16S, 1)
    cv2.cv.SaveImage('image'+str(click)+'.jpg',bitmap)
    click=click+1   
    #time.sleep(3)

I assume you have. Just double checking.

The above code SHOULD loop over it 10 times, give you 10 seconds to click everytime so you can take another picture. If you don't click the right key to take a picture within 10 seconds it should exit the while loop. I don't ever program in Python, so it might require some testing or debugging. Good luck!

I don't usually use Python, but in C++ we have an imwrite function in openCV. I just googled it and it seems to be there for opencv for python too.

Try:

cv2.imwrite(FileName, cv_image)

As for your code, I don't see a (non commented) while loop anywhere in your edited posts. Considering you want to do it every time you click, your code should look like this:

while click < 10:
    c=cv2.waitKey(10)
    if c != 10
            break
    h,w=cv_image.shape
    bitmap=cv2.cv.CreateImage((w,h), cv2.cv.IPL_DEPTH_16S, 1)
    cv2.cv.SaveImage('image'+str(click)+'.jpg',bitmap)
    click=click+1   
    #time.sleep(3)

The above code SHOULD loop over it 10 times, give you 10 seconds to click everytime so you can take another picture. If you don't click the right key to take a picture within 10 seconds it should exit the while loop. I don't ever program in Python, so it might require some testing or debugging. Good luck!

I don't usually use Python, but in C++ we have an imwrite function in openCV. I just googled it and it seems to be there for opencv for python too.

Try:

cv2.imwrite(FileName, cv_image)

As for your code, I don't see a (non commented) while loop anywhere in your edited posts. Considering you want to do it every time you click, your code should look like this: