Problems transferring images with USB-VCP commands

General discussion about topics related to OpenMV.
jagh2609
Posts: 7
Joined: Mon Aug 07, 2017 12:25 pm

Problems transferring images with USB-VCP commands

Postby jagh2609 » Thu Sep 28, 2017 6:14 pm

Good afternoon I wanted to tell you something that happened to me when using the camera to transfer images to a client through the USB-VCP commands.
Even though the camera almost always sends the requested image correctly. Sometimes the image that is sent is cut (CapturaOCRW146.jpg) and at other times the image that is sent is damaged (CapturaOCRW26.jpg).

When opening the file of the damaged image in hexadecimal format I noticed that at the beginning there was a text that was sent to print in the code.

It is not clear to me how this text is entered into a variable received with the command img = sensor.snapshot ().

I am attaching the above code and images to see if you can explain to me why this error occurs and how to try to solve it.

Thanks in advance.
Attachments
main.py
Main program
(4.42 KiB) Downloaded 27 times
CapturaOCRW26_HXD.JPG
Hexadecimal view of the CapturaOCR26.jpg image
CapturaOCRW26_HXD.JPG (808.46 KiB) Viewed 422 times
CapturaOCRW146.jpg
Incomplete image from Camera
CapturaOCRW146.jpg (13 KiB) Viewed 422 times
User avatar
kwagyeman
Posts: 1310
Joined: Sun May 24, 2015 2:10 pm

Re: Problems transferring images with USB-VCP commands

Postby kwagyeman » Thu Sep 28, 2017 7:43 pm

Is this from the USB DGB protocol that OpenMV IDE uses to communicate to the camera? Or, is this your code printing images via uart.write(img.compressed())?
Nyamekye,
jagh2609
Posts: 7
Joined: Mon Aug 07, 2017 12:25 pm

Re: Problems transferring images with USB-VCP commands

Postby jagh2609 » Mon Oct 02, 2017 3:38 pm

No, this is the image that resulted when I used the "communication-Serial.py" script to send the command "CapturaOCRW" to the camera when it is in stand-alone mode.
On line 104 of the main.py script, the image is sent through the usb.send (image) comabndo.

This script works wonderfully all the time, however sometimes it delivers the cut images.

What really impacted me was that in one of those images that returned, in the header of the JPG file was embedded the text that was in a "Print" command before in the script.
I also attached the script "communication-Serial.py" so that the communication between the PC and the camera can be understood.

By the way, another question I wanted to ask is that if you do not plan to get a more powerful camera in terms of ram and image quality? it would be great if they improved the hardware because you have developed excellent software.
Attachments
Comunicacion-Serial.py
(1.45 KiB) Downloaded 31 times
User avatar
kwagyeman
Posts: 1310
Joined: Sun May 24, 2015 2:10 pm

Re: Problems transferring images with USB-VCP commands

Postby kwagyeman » Mon Oct 02, 2017 7:09 pm

I can't debug your question right at this moment. I will get to it though. As for your second question, yes, the next version of the system will have the same performance as the raspberry pi zero, or, as the original raspberry pi. But, while drawing less than 200 mA. We will also have support for global shutter imaging too. We plan to KickStart the camera next year. In the meantime, our goal is to grow the company as much as possible with the M7. Once the new cam comes out the goal is to get the price of the M7 down to make it into the low performance cheap option camera.
Nyamekye,
User avatar
kwagyeman
Posts: 1310
Joined: Sun May 24, 2015 2:10 pm

Re: Problems transferring images with USB-VCP commands

Postby kwagyeman » Wed Oct 04, 2017 12:05 am

On this line:

Code: Select all

if (str(msj) == "b'Captura'"):
                sensor.set_windowing((600, 480)) # V Res of 80 == less work (40 for 2X the speed).
                msje = ("Tomando Captura2")
                img = sensor.snapshot()
                usb.send(imagen)
The imagen variable is not initialized before previously... So, MicroPython might not have caught the variable was uninitiated... which means it might have sent data randomly from the heap.
Nyamekye,

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 1 guest