08-27-2020 09:21 AM
Hi guys , i have an object recognition function in python that can detect objects in an image and return the new image with the detected objects to the user . i am trying to integrate this function with Vision in Labview so that each frame that Vision takes will be sent to python in order to be processed . in my first build of my program i just loaded into python an image from my computer and everything worked fine , the problem is that i can't seem to pass the picture from Vision to the python function ( inserting it into the "pack"block ).
above in the blue rectangle is the part of Vision , it gives an output of type image but i don't know how to enter it into thr pack block as i said . as you can see there is a part that like i said takes a picture froma folder and passes it into python ( this part works fine and i used it to test my code ) , i will now include the Labview code and what needs to be downloaded for those interested .
Labview :
1) Vision
2) Python integration toolkits
python :
1) python 3.6.0 64 bit ( it has to be 64 bit and 3.6.0 ) and when you install make sure it creates a path ( check the box on the installation window )
2) you need to go to cmd and download the following libraries ( open cmd as an administor , this is how it worked for me ) :
- type in cmd : pip install opencv-python
- after you pressed enter and downloaded open cv type : pip install cvlib
- type : pip install tensorflow
- type : pip install matplotlib
- type : pip install numpy
- type : pip install protobuf==3.6.0 ( it has to be this version even if you get a warning from tensorflow )
the programs :
Labview - after you download the python integration toolkit you just need to enter the example of image processing with opencv that comes with it and we just need to cahnge a few things , first we need to add the python exe path as you can see in the first picture above in the "new" block , for finding the correct path just run this program on python :
import sys
print(sys.executable)
after that enter into idle of python and open the face program that is running from this exampale and delete everything and put this instead :
import sys
import cv2
import matplotlib.pyplot as plt
import cvlib as cv
from cvlib.object_detection import draw_bbox
import os
def find_faces(color_img, neighbors, scalefactor=1.05):
frame = color_img
bbox, label, conf = cv.detect_common_objects(frame, confidence=0.25, model='yolov3-tiny')
output_image = draw_bbox(frame, bbox, label, conf)
return(output_image)
i will inculde some pictures that might help some :
above is the other part of the program ( you won't need this if you open the example that comes with the kit )
06-25-2021 04:19 AM
PLS I want to 2019 Version