OV7670 image to bytes array?

Hi to everyone, followed this guide: How to Use OV7670 Camera Module with Arduino​ Uno I have connected camera module OV7670 to arduino and it works perfectly.

Now I need to get snapshots somehow and display it on simple web page as image. To do this, I need get data as bytes array from camera but I can't find information how to do that. Can somebody help me, please, with little example of code or some information?

Thanks!

I have connected camera module OV7670 to arduino and it works perfectly.

How do you know that the setup works perfectly if you don't get an image from the camera?

If you get the image by the serial interface you already got a byte array. The Arduino cannot hold that byte array as it's memory is by far not big enough.

The hardware combination is a rather bad choice to display a picture on a web page.

pylon:
How do you know that the setup works perfectly if you don’t get an image from the camera?

If you get the image by the serial interface you already got a byte array. The Arduino cannot hold that byte array as it’s memory is by far not big enough.

The hardware combination is a rather bad choice to display a picture on a web page.

I can get image, but with additional software (like java application from example or windows form one), but I can’t understand how to get bytes, in what place of code it has that data?

Do you think, I can’t create web page with button that will be load image from camera and display it on website by manual click?

AndreyZelenchuk:
Hi to everyone, followed this guide: How to Use OV7670 Camera Module with Arduino​ Uno I have connected camera module OV7670 to arduino and it works perfectly.

Now I need to get snapshots somehow and display it on simple web page as image. To do this, I need get data as bytes array from camera but I can't find information how to do that. Can somebody help me, please, with little example of code or some information?

Thanks!

EXACTLY what type of a file is the web page looking for? Can you describe it other than a byte array? How do you KNOW it needs an array of bytes? How many dimensions in the array?

Paul

PS:
After looking at the link, I have to ask if you used the provided PC program: Serial Port Reader is a simple GUI. This captures the base64 encode and decodes it to form an image. Just follow these simple steps to use Serial Port Reader

Paul_KD7HB:
EXACTLY what type of a file is the web page looking for? Can you describe it other than a byte array? How do you KNOW it needs an array of bytes? How many dimensions in the array?

Paul

PS:
After looking at the link, I have to ask if you used the provided PC program: Serial Port Reader is a simple GUI. This captures the base64 encode and decodes it to form an image. Just follow these simple steps to use Serial Port Reader

I can specify dimensions of image so I know sizes. I need some example of code how to get bytes from that tutorial, this is what I have asked.

Do you think, I can't create web page with button that will be load image from camera and display it on website by manual click?

With the hardware you mentioned yet it is impossible (as you don't even have network access).

So go a few steps back and tell us more about what you're trying to achieve, what hardware you currently have, what hardware you're willing to invest into, what web server you meant in your post, etc.

The combination of a Raspberry Pi with a Pi camera would provide a solution that is able to serve a picture to the internet without all the restrictions you have on the Arduino platform. There may be reasons why you chose the Arduino platform but you didn't tell us yet.

AndreyZelenchuk:
I can specify dimensions of image so I know sizes. I need some example of code how to get bytes from that tutorial, this is what I have asked.

Yes, you can specify the final dimensions for the web page, but almost all images are compressed to limit size. The question was what type of image compression does the web page expect.

Paul

As I see, nobody understood my question at all, sorry for that…

I asked for a help with code and to be clear more, with place in code where I can store image from camera to bytes array and use it in future for other place (website, etc).

AndreyZelenchuk:
As I see, nobody understood my question at all, sorry for that...

I asked for a help with code and to be clear more, with place in code where I can store image from camera to bytes array and use it in future for other place (website, etc).

No, we understood your question very well. But, you keep insisting the image is the file of bytes. IT is not. It is IN the file of bytes, but until you decode all the information in the file, you do not have an image. One pixel may take several bytes to define.

Have you used the sample PC program that is available to decode the file and produce an image? If you want an image that will fit some size, then you need to perform that same steps and then convert the results to a JPEG or other format acceptable to a web page.

Paul

Paul_KD7HB:
No, we understood your question very well. But, you keep insisting the image is the file of bytes. IT is not. It is IN the file of bytes, but until you decode all the information in the file, you do not have an image. One pixel may take several bytes to define.

Have you used the sample PC program that is available to decode the file and produce an image? If you want an image that will fit some size, then you need to perform that same steps and then convert the results to a JPEG or other format acceptable to a web page.

Paul

I wish I have some example of PC program or some grabber that can get image :slight_smile:

Basically, all what I want, is receive an image in readable format (jpeg or another one) but to get that, I believe, I have to get bytes first.

I did not look again, but the link to the device data sheet info said there was a PC program available to display the picture and actually showed a screen shot of the image from the camera.

Paul

Paul_KD7HB:
I did not look again, but the link to the device data sheet info said there was a PC program available to display the picture and actually showed a screen shot of the image from the camera.

Paul

Yes, you are right, but I'm not a reverse engineer that can disassemble that program unfortunately :frowning:

The data information also told you the name of the encoding scheme and now you can have fun implementing that scheme in code on your PC.

Paul

Read here.
https://forum.arduino.cc/index.php?topic=159557.0

Take care that the OV7670 has a sensor 640x480 pixel->307200 bytes (yes one byte per pixel!).
It uses a Bayer filter so you have to debayer the image in order to obtain a color image.
You can find the debayer program in the GitHub repo.
This project uses an OV7670 without FIFO. If you have an OV7670 with FIFO, usually a chip in the back of the module, you should use other codes that you can find around. FIFO is a sort of RAM so that you can read the image without precise timing that is required if you don't have FIFO.