Please post the steps of what exactly you did.
i download openmv-cascade.py and insert path of xml file in script
when i want run script in raspbian return this error
Can you run it from the terminal so we can see the error ?
No the script should work out of the box though, anyway weâre going to add a built-in cascade converter to the IDE itâs just a matter of time.
It looks like you have html in your script⌠i.e. you didnât download it rightâŚ
thanks for replying
How to write the xml file to the script or in the other words how to Introduce xml file to script?
Hi, you pass the xml file after the script name.
Hi, you pass the xml file after the script name.
I put the xml name in the script or in the terminal ?
if i must put in script
It is possible to place the modified file?
Hi download the script like so:
wget https://raw.githubusercontent.com/openmv/openmv/master/usr/openmv-cascade.py
Then run it like this:
python2.7 openmv-cascade.py cascade_file.xml
Hi download the script like so:
wget https://raw.githubusercontent.com/openmv/openmv/master/usr/openmv-cascade.py
Then run it like this:
python2.7 openmv-cascade.py cascade_file.xml
Thank you so much
hai,i got a problem here,when i try to convert the xml file using converter as here : https://github.com/openmv/openmv/blob/master/usr/openmv-cascade.py
i got an error. So here i attach the xml file.Seem i stuck to convert to cascade file.After that,does the cascade embedded directly to camera or i need to transfer the cascade into internal memory to load on another script.
myhaar.xml (1.75 KB)
hai,i got a problem here,when i try to convert the xml file using converter as here : https://github.com/openmv/openmv/blob/master/usr/openmv-cascade.py
i got an error. So here i attach the xml file.Seem i stuck to convert to cascade file.After that,does the cascade embedded directly to camera or i need to transfer the cascade into internal memory to load on another script.
The converter doesnât work on Windows, try the attached cascade.
You need to copy the cascade to flash or sd card, see examples and replies to this post.
myhaar.cascade.zip (222 Bytes)
hai,i got a problem here,when i try to convert the xml file using converter as here : https://github.com/openmv/openmv/blob/master/usr/openmv-cascade.py
i got an error. So here i attach the xml file.Seem i stuck to convert to cascade file.After that,does the cascade embedded directly to camera or i need to transfer the cascade into internal memory to load on another script.The converter doesnât work on Windows, try the attached cascade.
You need to copy the cascade to flash or sd card, see examples and replies to this post.
it all done,thanks to you.But the detection still low rate,does i need to add more positive image during making a cascade?.here i attach the video and also coding
import sensor, time, image
lens_mm = 2.8 # Standard Lens.
average_spool_height_mm = 360.0 #
image_height_pixels = 240.0 # QVGA
sensor_h_mm = 2.952 # For OV7725 sensor - see datasheet.
offest_mm = 100.0 # Offset fixâŚ
focal length - How do I calculate the distance of an object in a photo? - Photography Stack Exchange
def rect_size_to_distance(r): # r == (x, y, w, h) â r[3] == h
return ((lens_mm * average_spool_height_mm * image_height_pixels) / (r[3] * sensor_h_mm)) - offest_mm
Reset sensor
sensor.reset()
Sensor settings
sensor.set_contrast(1)
sensor.set_gainceiling(16)
HQVGA and GRAYSCALE are the best for face tracking.
sensor.set_framesize(sensor.QVGA)
sensor.set_pixformat(sensor.GRAYSCALE)
Load Haar Cascade
By default this will use all stages, lower satges is faster but less accurate.
spool_cascade = image.HaarCascade(âmyhaar.cascadeâ, stages=1)
print(spool_cascade)
FPS clock
clock = time.clock()
while (True):
clock.tick()
Capture snapshot
img = sensor.snapshot()
Find objects.
Note: Lower scale factor scales-down the image more and detects smaller objects.
Higher threshold results in a higher detection rate, with more false positives.
objects = img.find_features(spool_cascade, threshold=0.75, scale_factor=1.25)
Draw objects
for i in range(len(objects)):
img.draw_rectangle(objects_)
img.draw_string(objects[0] - 16, objects[1] - 16, âDistance %d mmâ % rect_size_to_distance(objects))
img.draw_cross(img.width()//2, img.height()//2, size = min(img.width()//5, img.height()//5))
\
Print FPS.
Note: Actual FPS is higher, streaming the FB makes it slower.
print(âFPS %fâ % clock.fps())_
it all done,thanks to you.But the detection still low rate,does i need to add more positive image during making a cascade?.here i attach the video and also coding
Iâm not sure, maybe try a lower scaling factor (1.15).
it all done,thanks to you.But the detection still low rate,does i need to add more positive image during making a cascade?.here i attach the video and also coding
Iâm not sure, maybe try a lower scaling factor (1.15).
itâs done.thanksâŚNow iâm designing alignment algorithm for AGV.Openmv camera as input,then arduino as controller also encoder for each mecanum wheels as feedback for positioning agv.Btw can i make that openmv determine the spool position either left or right side plus with distance from camera(already done) to tell AGV position(Camera) against spool(target) ?