How can I print from the IDE into another software?

OpenMV related project discussion.
bldotson
Posts: 4
Joined: Tue Apr 03, 2018 12:48 am

How can I print from the IDE into another software?

Postby bldotson » Tue Apr 03, 2018 12:56 am

Hello! I have a code going right now that is continuously printing out the centroids of tracked objects to the OpenMV IDE terminal; however, I would really like to export those values to MATLAB for processing. Is this possible? If so, how can I do this? I'd appreciate any links or tutorials I can get. I'm very new to python! Thank you!! :D
User avatar
kwagyeman
Posts: 2191
Joined: Sun May 24, 2015 2:10 pm

Re: How can I print from the IDE into another software?

Postby kwagyeman » Tue Apr 03, 2018 1:10 am

Hi, with the same script... Save that to the OpenMV Cam as main.py. see the tools -> save script to OpenMV Cam.

Then reset your OpenMV Cam under the same menu in tools.

Finally, in MATLAB, open the serial port that your OpenMV appears as and you'll get that debug text.
Nyamekye,
bldotson
Posts: 4
Joined: Tue Apr 03, 2018 12:48 am

Re: How can I print from the IDE into another software?

Postby bldotson » Thu Apr 05, 2018 1:06 am

Thank you so much for your help! I do have another question, but it's okay if you don't have an answer. I am trying to get the sensor to find and locate stars. I've been able to get it to track small LED lights with the find_blobs command in grayscale since it just looks for bright spots. However, stars are so much dimmer and smaller, I can't even see them in the buffer. Is there a way to change exposure, shutter, or ISO? I'd appreciate any ideas (: thank you again!
User avatar
kwagyeman
Posts: 2191
Joined: Sun May 24, 2015 2:10 pm

Re: How can I print from the IDE into another software?

Postby kwagyeman » Thu Apr 05, 2018 1:32 am

Please see the Examples -> Sensor Control and look for the exposure control.
Nyamekye,
bldotson
Posts: 4
Joined: Tue Apr 03, 2018 12:48 am

Re: How can I print from the IDE into another software?

Postby bldotson » Mon Apr 09, 2018 6:51 pm

Hello again Nyamekye,

You have been such great help for my project! I have another question, but it might need a bit of context to answer:

I am designing a star tracker. The sensor so far has been able to pick up 1 or 2 stars through the find_blobs color tracking in Grayscale. However, it considers a lot of random ambient light spots around the edges "blobs". I figured it'd be a little more accurate and less likely to pick up those areas if I was in YUV mode, since the Y is specifically brightness. Does the find_blobs command still work the same in YUV mode? And do I set the threshold the same way? And lastly, do you have any examples of this?

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

Re: How can I print from the IDE into another software?

Postby kwagyeman » Mon Apr 09, 2018 9:43 pm

Hi, please switch to RGB565 mode and then use find_blobs. It will then use LAB thresholds like YUV.

That said, generally you need to filter the output of find-blobs(). Are the white spots on the boarder more than 1 pixel compared to the starts? If so, then reject them. Find blobs allows you to set a filter callback method in Python. You can also filter blobs after the list of blobs has been returned.

Maybe post an image so I can see what to do?
Nyamekye,
bldotson
Posts: 4
Joined: Tue Apr 03, 2018 12:48 am

Re: How can I print from the IDE into another software?

Postby bldotson » Wed Apr 11, 2018 1:25 am

Okay, I attached a screenshot here. I drew the two arrows pointing at the actual stars. The rest is noise I think. I still have it on grayscale, but I will try your suggestion tomorrow night. I have also ordered a telephoto lens since most star trackers have a 10-12 degree FOV anyway. So that might help as well (:
Attachments
InkedOpenMV_IDE_arrows.jpg
InkedOpenMV_IDE_arrows.jpg (904.35 KiB) Viewed 399 times
User avatar
kwagyeman
Posts: 2191
Joined: Sun May 24, 2015 2:10 pm

Re: How can I print from the IDE into another software?

Postby kwagyeman » Wed Apr 11, 2018 2:42 am

Check this out:

http://book.pythontips.com/en/latest/map_filter.html

In particular, checkout the filter method. What you should do is filter out blobs with more than 5 pixels and more than 9 area, then check that the width and height are equal:

E.g:

Code: Select all

list(filter(lambda x: x.pixels()==1 and x.w() == x.h() and x.w()*x.h() <= 9, img.find_blobs(...)))
Nyamekye,

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests