beginner error probably

Discussion related to "under the hood" OpenMV topics.
rosir
Posts: 6
Joined: Thu Mar 29, 2018 8:53 am

beginner error probably

Postby rosir » Thu Mar 29, 2018 12:58 pm

Hello,

Camera: openMV M2 camera - OV7725
IDE: updated 1.8.1
Firmware: updated 2.7.0

1) After buying, there is a camera, I go back to work.
I am having problems with the examples.
For example with find_circle .py
I get the error message
AttributeError Image object has no attribute find_circles
I have the same type of error with find_lines.py
Why?

2 °) I do not understand the management of the colors, by moment it is specified RGB565 and to others one finds RGB888.
The camera works in 2 or 3 bytes.

3 °) The documentation on the web is numbered 1.9.2 and the last downloadable version is 1.8.1. Why?

4 °) If I delete the last line ("img = sensor.snapshot ()") in the following program:

Code: Select all

import sensor, image, pyb
img=sensor.snapshot()
couleur=(0,255,0)
print(couleur)
img.draw_cross(100, 100, size=50, color=couleur)

for colonne in range(200):
    img.set_pixel(colonne, 10, couleur)

print("C'est fini")
img=sensor.snapshot()
the program no longer shows me the line and the cross. Why?

Thank you.
User avatar
kwagyeman
Posts: 2113
Joined: Sun May 24, 2015 2:10 pm

Re: beginner error probably

Postby kwagyeman » Fri Mar 30, 2018 12:47 am

Hi, sorry for not getting back to you quicker. I can only answer questions on my phone during the day. For your questions I need my desktop:

1. I don't get this error. Can you post the script you are using? Getting this kinda of error means something was corrupted or your firmware version is old.

2. The camera is RGB565, but, from the user interface you supply RGB888 colors or LAB colors.

3. There are 3 versions of things, we using MicroPython which is the version 1.9.2, then OpenMV IDE has a version 1.8.1, and then our build of MicroPython's firmware with our vision libraries is 2.7.0. It's not really possible to keep all them in sync since they update at different rates.

4. The frame buffer is transferred to the PC when snapshot is run and a new frame is then captured. Without the line at the end the transfer doesn't happen. That said, I just had an idea to transfer the frame buffer on script end. I will fix that for the next firmware release. We've been busy for the last month fixing tons of stuff in the library to bring it up to having a similar suite of features as OpenCV.
Nyamekye,
rosir
Posts: 6
Joined: Thu Mar 29, 2018 8:53 am

Re: beginner error probably

Postby rosir » Fri Mar 30, 2018 1:03 pm

Hello,

No problem, I manage several projects donations when I'm stuck for one I always work for others.

1 °) I simply use the openMV find_circle.py sample file

Code: Select all

# Find Circles Example
#
# This example shows off how to find circles in the image using the Hough
# Transform. https://en.wikipedia.org/wiki/Circle_Hough_Transform
#
# Note that the find_circles() method will only find circles which are completely
# inside of the image. Circles which go outside of the image/roi are ignored...

import sensor, image, time

sensor.reset()
sensor.set_pixformat(sensor.RGB565) # grayscale is faster
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()

while(True):
    clock.tick()
    img = sensor.snapshot().lens_corr(1.8)

    # Circle objects have four values: x, y, r (radius), and magnitude. The
    # magnitude is the strength of the detection of the circle. Higher is
    # better...

    # `threshold` controls how many circles are found. Increase its value
    # to decrease the number of circles detected...

    # `x_margin`, `y_margin`, and `r_margin` control the merging of similar
    # circles in the x, y, and r (radius) directions.

    for c in img.find_circles(threshold = 2000, x_margin = 10, y_margin = 10, r_margin = 10):
        img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))
        print(c)

    print("FPS %f" % clock.fps())
2 °) In the IDE I put (255,0,0) to have flashing red and in the camera, there will be (1111100000000000) 2 = (63488) 10?

3 °) I was confusing between openMV and Micropyton.

4 °) OK I understood.

Thank you.
User avatar
kwagyeman
Posts: 2113
Joined: Sun May 24, 2015 2:10 pm

Re: beginner error probably

Postby kwagyeman » Sat Mar 31, 2018 1:03 pm

1) The script seems to run fine on my OpenMV Cam. Using the latest 2.7.0 firmware. Are you using a M7 camera? The M4 is missing a lot of features.

2) Yes, however, the binary data is stored byte reversed. So, the internal data format is RGB565 like you have below but with the top and bottom bytes swapped. It's like this because of how the data bus output of the OV7725 camera works.
Nyamekye,
rosir
Posts: 6
Joined: Thu Mar 29, 2018 8:53 am

Re: beginner error probably

Postby rosir » Wed Apr 04, 2018 8:44 am

Hello
1 °) Yes indeed, I have an M4. But on the page https://openmv.io/products/openmv-cam-m4-v1 it is specified that it is possible to do line detection.
Can we have the list of operational functions on the M4.

2 °) Ok thank you.

Thank you.
User avatar
kwagyeman
Posts: 2113
Joined: Sun May 24, 2015 2:10 pm

Re: beginner error probably

Postby kwagyeman » Wed Apr 04, 2018 11:12 am

Circle detection is not on the M4.

You can however track colors and use the Get Regression method for line tracking.

...

I don't have a formal list of features missing on the M4.
https://github.com/openmv/openmv/blob/m ... b_config.h

The above file shows what's been removed.
Nyamekye,
rosir
Posts: 6
Joined: Thu Mar 29, 2018 8:53 am

Re: beginner error probably

Postby rosir » Wed Apr 04, 2018 12:02 pm

I was wrong. As stated at the beginning of the 1st post, I have an M2.

I did not understand everything.

// Enable find_circles ()
// # define IMLIB_ENABLE_FIND_CIRCLES
and
// Enable find_lines ()
// # define IMLIB_ENABLE_FIND_LINES

Let's say that the 2 functions are not functional. But
// find_lines () is required by the old find_line_segments ()
#if defined (IMLIB_ENABLE_FIND_LINE_SEGMENTS) \
&&! defined (IMLIB_ENABLE_FIND_LINES)
#define IMLIB_ENABLE_FIND_LINES
#endif
the IMLIB_ENABLE_FIND_LINES function is functional.
??? // # define IMLIB_ENABLE_FIND_LINES and #define IMLIB_ENABLE_FIND_LINES ???
User avatar
kwagyeman
Posts: 2113
Joined: Sun May 24, 2015 2:10 pm

Re: beginner error probably

Postby kwagyeman » Wed Apr 04, 2018 5:08 pm

Hi, line segment detection is not enabled on the M4. It could be if you need a custom firmware release.

We ran out of memory on the M4 and only enable the most basic features on it.
Nyamekye,
rosir
Posts: 6
Joined: Thu Mar 29, 2018 8:53 am

Re: beginner error probably

Postby rosir » Thu Apr 05, 2018 10:24 am

Hello,

1 °) You could make me a firmware for my M2?
With line detection, segment detections, circle detection, color management, contrast, blobs, management of communication to an arduino (Board-control)?

2 °) For another project, you could make me another firmware with the management of codes (qrcodes, ...) and the management of communication to an arduino (Board-control).


Thank you.
User avatar
kwagyeman
Posts: 2113
Joined: Sun May 24, 2015 2:10 pm

Re: beginner error probably

Postby kwagyeman » Thu Apr 05, 2018 10:46 am

I recommend you learn to build the firmware yourself:

https://github.com/openmv/openmv/wiki

My turn around time for requests can take a while.

I have to do taxes this weekend... So, it would be beyond that.
Nyamekye,
rosir
Posts: 6
Joined: Thu Mar 29, 2018 8:53 am

Re: beginner error probably

Postby rosir » Fri Apr 06, 2018 1:48 pm

Good evening,

I find the idea to be able to make his own firmware very interesting.
I'm leaving for a few days on vacation. If you have the time, I want you to make me the firmware for the recognition of lines, segments, ...
so that I can test on my return.

And I want to try to fool myself for the codes.

Good luck for your statements.

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests