Help with code date

OpenMV related project discussion.
kk4bha
Posts: 4
Joined: Tue Nov 26, 2019 11:20 am

Help with code date

Postby kk4bha » Tue Nov 26, 2019 11:33 am

I have product that has a code date on it, and if the code date is missing I need to trigger an output. What is the best library or script to use for this?
User avatar
iabdalkader
Posts: 1085
Joined: Sun May 24, 2015 3:53 pm

Re: Help with code date

Postby iabdalkader » Tue Nov 26, 2019 12:28 pm

kk4bha wrote:
Tue Nov 26, 2019 11:33 am
I have product that has a code date on it, and if the code date is missing I need to trigger an output. What is the best library or script to use for this?
What does the code look like ? Please attach a photo.
kk4bha
Posts: 4
Joined: Tue Nov 26, 2019 11:20 am

Re: Help with code date

Postby kk4bha » Tue Nov 26, 2019 1:28 pm

Here is sample code date I have to use. I have the globe shutter sensor to work with this project. Product is moving at 400 packs per min
Attachments
test.mp4
(73.91 KiB) Downloaded 17 times
Last edited by kk4bha on Tue Nov 26, 2019 2:17 pm, edited 1 time in total.
User avatar
kwagyeman
Posts: 3717
Joined: Sun May 24, 2015 2:10 pm

Re: Help with code date

Postby kwagyeman » Tue Nov 26, 2019 1:50 pm

Hi, 400 pictures a second is not possible to process. If you use multiple cameras what's the minimum fps each could run at? Better techniques are available as you decrease the frame rate.
Nyamekye,
kk4bha
Posts: 4
Joined: Tue Nov 26, 2019 11:20 am

Re: Help with code date

Postby kk4bha » Tue Nov 26, 2019 2:18 pm

I'm sorry that was a type O on my part. It is 400 packs per min
User avatar
kwagyeman
Posts: 3717
Joined: Sun May 24, 2015 2:10 pm

Re: Help with code date

Postby kwagyeman » Tue Nov 26, 2019 2:59 pm

K, that's pretty easy. Um, if lighting is constant I'd do blob tracking. Just use canny edge detection (search int he API for it) and then use get_stats() and compare the stats of an object without a date code to one with a date code. You should see a vast difference.
Nyamekye,
kk4bha
Posts: 4
Joined: Tue Nov 26, 2019 11:20 am

Re: Help with code date

Postby kk4bha » Mon Dec 02, 2019 3:37 pm

Hey is the sample code I'm running and below is a video of the results I'm getting. I don't know how to get the stat to work or better yet get a pass or fail results to then send to output pin to turn on a LED or Relay.

Code: Select all

# Edge detection with Canny:
#
# This example demonstrates the Canny edge detector.
import sensor, image, time

sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565
sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others)
sensor.skip_frames(time = 2) # Let new settings take affect.
sensor.set_gainceiling(8)

clock = time.clock() # Tracks FPS.
while(True):
    clock.tick() # Track elapsed milliseconds between snapshots().
    img = sensor.snapshot() # Take a picture and return the image.
    # Use Canny edge detector
    img.find_edges(image.EDGE_CANNY, threshold=(50, 80))
# Faster simpler edge detection
    #img.find_edges(image.EDGE_SIMPLE, threshold=(100, 255))
    print(clock.fps()) # Note: Your OpenMV Cam runs about half as fast while
Attachments
test111.mp4
(643.14 KiB) Downloaded 17 times
User avatar
kwagyeman
Posts: 3717
Joined: Sun May 24, 2015 2:10 pm

Re: Help with code date

Postby kwagyeman » Mon Dec 02, 2019 7:41 pm

That literally our example for to get you started... Did you try modifying the code and reading the API on OpenMV.io/docs? You have to modify the examples to do explicitly what you want to do.
Nyamekye,

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests