computer_science:computer_vision:opencv:object_identification_tensorflow_opencv_imageai_yolo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
computer_science:computer_vision:opencv:object_identification_tensorflow_opencv_imageai_yolo [2020/08/07 18:33] carlossousacomputer_science:computer_vision:opencv:object_identification_tensorflow_opencv_imageai_yolo [2024/08/16 12:53] (current) – removed carlossousa
Line 1: Line 1:
-====== Object Detection with Tensorflow, OpenCV, ImageAI and YOLO ====== 
- 
-===== Requirements: ===== 
- 
-Be sure to have the [[:computer_science:computer_vision:opencv:object_identification_tensorflow_opencv_imageai_yolo_requirements|requirements]] installed. 
- 
-===== The Code: ===== 
- 
-==== Initialize the libraries ==== 
- 
-<code python> 
-import cv2 as cv #Loads ComputerVision / OpenCV 
-from imageai.Detection import ObjectDetection as od # Loads ImageAI 
- 
-import numpy as np # Imports NumPY 
-import requests as req # Imports Requests 
-import os as os # Imports OS Module 
- 
- 
-</code> 
- 
-==== Testing if OpenCV is working: ==== 
- 
-<code python> 
-url = 'https://p7.hiclipart.com/preview/124/937/193/architectural-engineering-engineer.jpg' # Image to be Downloaded 
-r = req.get(url) # Pass the URL as a Request.Get 
-with open('testimage.jpg', 'wb') as outfile: # Writes the Image to the system 
-    outfile.write(r.content) 
-img = cv.imread('testimage.jpg') # Reads an image with OpenCV 
-window_name = 'image' # Defines a Window Name 
-cv.imshow(window_name, img) # Show the Image on a Window 
-cv.waitKey(0) # Wait for any Key to be pressed 
-cv.destroyAllWindows() # Destroy (all) previous created Windows 
- 
- 
-</code> 
- 
-==== Preparing for the upcoming project: ==== 
- 
-Now that we tested that OpenCV is working let's edit that last piece of code, change it to a function, so we can reutilize it often. The complete code until now should look like this: 
- 
-<code python> 
-import cv2 as cv 
-from imageai.Detection import ObjectDetection as od 
- 
-import numpy as np 
-import requests as req 
-import os as os 
- 
-def showImage(img): 
-    window_name = 'image' 
-    cv.imshow(window_name, img) 
-    cv.waitKey(0) 
-    cv.destroyAllWindows() 
- 
-</code> 
- 
-===== External References: ===== 
- 
-[[https://www.codeproject.com/Articles/5270236/Installing-OpenCV-and-ImageAI-for-Object-Detection|https://www.codeproject.com/Articles/5270236/Installing-OpenCV-and-ImageAI-for-Object-Detection]] 
- 
  
  • computer_science/computer_vision/opencv/object_identification_tensorflow_opencv_imageai_yolo.1596818022.txt.gz
  • Last modified: 2023/12/01 13:07
  • (external edit)