Difference between revisions of "OpenCV4"
Line 36: | Line 36: | ||
==== Edge Detector==== | ==== Edge Detector==== | ||
+ | |||
+ | Once you have a picture, you may want to use edge detection to detect the chessboard region of interest. | ||
Follow these instruction for [https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_canny/py_canny.html Canny edge detection]. | Follow these instruction for [https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_canny/py_canny.html Canny edge detection]. | ||
Line 43: | Line 45: | ||
In order to use build-in function in Open CV: remember to <code>import</code> cv2. In the instruction, the <code>import</code> cv2 <code>as </code>cv means that you can now type in cv instead of cv2 when using build function. | In order to use build-in function in Open CV: remember to <code>import</code> cv2. In the instruction, the <code>import</code> cv2 <code>as </code>cv means that you can now type in cv instead of cv2 when using build function. | ||
− | + | ||
Use the following build-in code for Canny Detection: | Use the following build-in code for Canny Detection: | ||
Revision as of 18:43, 11 December 2018
Contents
Overview
This is a tutorial on how to install OpenCV4 and use camera module.
Materials/Prerequisites
- Raspberry Pi
- Raspberry Pi Camera
Process
Install OpenCV
Follow these instructions to install OpenCV onto your Raspberry Pi using the terminal.
- Important note: don't do
make-j4
. It may freeze so it best to just domake
ormake-j1
.
After you have successfully installed OpenCV, you will be able to use import cv2
. If you do it on the terminal, you want to put in these code source ~/.profile
and then workon cv
.
Capturing image
Following these step to set up your camera.
- Note: Ignoring GoPiGo installation.
Once the camera is set up, it is ready to take pictures. In order to capture image, follow these instruction
Note:
- Use
sleep
(measured in seconds) to create a delay between the preview:time.sleep(seconds)
- Another way to enable your camera is: go to the terminal → type in
sudo raspi-config
→ selectEnable Camera
→ press Enter → selectFinish
→ reboot and log back on to the Raspberry Pi.
Edge Detector
Once you have a picture, you may want to use edge detection to detect the chessboard region of interest.
Follow these instruction for Canny edge detection.
- Note: Scroll down to the Explanation.
In order to use build-in function in Open CV: remember to import
cv2. In the instruction, the import
cv2 as
cv means that you can now type in cv instead of cv2 when using build function.
Use the following build-in code for Canny Detection:
Canny( detected_edges, detected_edges, lowThreshold, lowThreshold*ratio, kernel_size )
Ex:
dst = cv.Canny(src, 50, 200, None, 3)
Hougline Transformation
Authors
- Nhut Dang
- Robert Goodloe
- Ethan Shry(TA)
Fall 2018