Import Match software in OpenMV

Hello, I’m currently working with a friend in a Masters Project to develop a star tracker camera to calculate the geographic coordinates of a vehicle based on stars position in the sky. For that purpose we decided to use the OpenMV board because of the various capibilities it has.

Right now we are facing some issues related to the working algorithms of our software to detect the stars and their position. To make this work we need to import a software called “Match – a program for matching star lists” that has the format ANSI C that only requires the math library to work. The self test script of this software is written in Perl, working with Perl 5.

Is there a way to import this software to work on an image in the OpenMV IDE, considering that we already have a SD Card to allow more storage space for images taken. If so, can you help us do that?

Best regards.

Hi, software already made a star detector with the OpenMV Cam:

Probably should look at what he did.

Hello, after watching the major characteristics of the software you pointed, we considered that our implementation was a bit different than what is made there. Going straight to the point, we would like to know if a software like match as mentioned before can be imported and implemented to work on OpenMV. Can you guide us in some way to do such process if possible?

Greetings.

AH, you want to do this in C.

So, you need to write a python module. First, you should learn to compile the firmware: openmv/src at master · openmv/openmv · GitHub

After that: See this guide on how to write a MicroPython driver: MicroPython Internals — MicroPython 1.14 documentation

Hello,

Thanks for your answers so far, we tried our best but with new instructions we followed another path. We have another question now related to the treatment and display of the images.

So right now, we are loading an image from the sd card we inserted on the OpenMv Cam H7 Plus, and we are trying to process the image with filters and the use of thresholds and then displaying it.
We have already achieved the load part, but we are having issues with the following ones.

Can you point out the steps we should take to succeed on this tasks? Our main goal like is said is load image → process → display.

Thanks for the attention.

You need to ask a specific question.

Hello,

I’m sorry if i wasn’t too clear, but we are trying to load one image that we have from the sd Card so we can apply some filters to it, like gaussian, binarization, etc.
But we are facing a problem that is “image is not mutable” after we apply the filters and try to display it.
Below is the code we are running at this time, if that helps in anyway.

Hope I made it clearer.

Thanks.

# Histogram Equalization
#
# This example shows off how to use histogram equalization to improve
# the contrast in the image.

import sensor, image, time, micropython , pyb

EXPOSURE_TIME_SCALE = 0.8

sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.FHD)
sensor.skip_frames(time = 2000)
clock = time.clock()

sensor.set_auto_gain(False)
sensor.set_auto_whitebal(False)
# Need to let the above settings get in...
sensor.skip_frames(time = 500)

current_exposure_time_in_microseconds = sensor.get_exposure_us()
print("Current Exposure == %d" % current_exposure_time_in_microseconds)

# Auto exposure control (AEC) is enabled by default. Calling the below function
# disables sensor auto exposure control. The additionally "exposure_us"
# argument then overrides the auto exposure value after AEC is disabled.
sensor.set_auto_exposure(False, \
    exposure_us = int(current_exposure_time_in_microseconds * EXPOSURE_TIME_SCALE))

print("New exposure == %d" % sensor.get_exposure_us())

thresholds=(210, 255)

kernel = [0, -1,  -1, \
          0,  1,  1, \
           -1,  1,  0]

kernel_size = 1

while(True):
    clock.tick()
    #img = sensor.snapshot().lens_corr(strength = 1.5, zoom = 1.1) #distorçao das lentes
    img= image.Image("stars.jpg", copy_to_fb = True)
    #hist=img.get_histogram()
  # thresholds = histogram.get_threshold()
    img = sensor.alloc_extra_fb(img.width(),img.height(), sensor.GRAYSCALE)
  #  t=threshold.value(153,255)
    img.morph(kernel_size , kernel)

    #img.gamma_corr(gamma = 0.5, contrast = 1.0, brightness = 0.1)
    img.gaussian(3)
    hist=img.get_histogram()
    stats=hist.get_statistics()
    img.binary([thresholds])

    if stats.mean() > 60:
     print('EXPO ALTA')

    if stats.stdev() >=7:
     print('MUITO RUIDO')

    if stats.max() < (150):
     print('EXPO BAIXA');


    print(img)
    print(stats)

We don’t support modifying jpg images. Please save the image as a bmp file.

(Adding support for loading jpg images is on the todo list, along with png images).