0% found this document useful (0 votes)
10 views4 pages

Duplichecker Plagiarism Report

Uploaded by

Aman Tiple
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Duplichecker Plagiarism Report

Uploaded by

Aman Tiple
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

PLAGIARISM SCAN REPORT

Date 2024-08-01

33% 67%
Words 951
Plagiarised Unique

Characters 7394

Content Checked For Plagiarism

1. HPFs and LPFs

After the initial imports, we define a 3x3 kernel and a 5x5 kernel, and then we load the image in grayscale.
After that, we want to convolve the image with each of the kernels. There are several library functions available for such a
purpose. NumPy provides the convolve function; however, it only accepts one-dimensional arrays.
Although the convolution of multidimensional arrays can be achieved with NumPy, it would be a bit complex.
SciPy's ndimage module provides another convolve function, which supports multidimensional arrays. Finally, OpenCV
provides a filter2D function (for convolution with 2D arrays) and a sepFilter2D function (for the special case of a 2D kernel
that can be decomposed into two one-dimensional kernels). The preceding code sample illustrates the ndimage.convolve
function. We will use the cv2.filter2D function in other samples in the Custom kernels – getting convoluted section of this
chapter. Our script proceeds by applying two HPFs with the two convolution kernels we defined. Finally, we also implement
a different method of obtaining an HPF by applying a LPF and calculating the difference between the original image. Let's
see how each filter looks. As input, we start with the following photograph:

Let's go through an example of applying an HPF to an image

import cv2 import numpy as np from scipy import ndimage kernel_3x3 = np.array([[-1, -1, - 1],
[-1, 8, -1],
[-1, -1, -1]]) kernel_5x5 = np.array([[-
1, -1, -1, -1, -1],
[-1, 1, 2, 1, -1],

[-1, 2, 4, 2, -1],
[-1, 1, 2, 1, -1],
[-1, -1, -1, -1, -1]])
img = cv2.imread("0105.png", 0)

2. Edge detection with Canny: -


OpenCV offers a handy function called Canny (after the algorithm's inventor, John F.
Canny), which is very popular not only because of its effectiveness, but also because of the simplicity of its
implementation in an OpenCV program since it is a one-liner:

edges = cv2.Canny(gray, 50, 120) minLineLength = 20 maxLineGap = 5 lines = cv2.HoughLinesP(edges, 1, np.pi/180.0, 20,

Page 1 of 4
minLineLength, maxLineGap) for x1, y1, x2, y2 in lines[0]:
cv2.line(img, (x1, y1), (x2, y2), (0,255,0),2) The result is a very clear identification of the edges:

3. Bounding box, minimum area rectangle, and minimum enclosing circle

This function – like all of OpenCV's drawing functions – modifies the original image.
Note that it takes an array of contours in its second parameter so that you can draw a number of contours in a single
operation.
Therefore, if you have a single set of points representing a contour polygon, you need to wrap these points in an array,
exactly like we did with our box in the preceding example.

The third parameter of this function specifies the index of the contours array that we want to draw: a value of -1 will
draw all contours; otherwise, a contour at
the specified index in the contours array (the second parameter) will be drawn.
Most drawing functions take the color of the drawing (as a BGR tuple) and its thickness (in pixels) as the last two
parameters.
The last bounding contour we're going to examine is the minimum enclosing circle:

circles = np.uint16(np.around(circles)) for i in circles[0,:]: # draw the outer circle cv2.circle(planets,(i[0],i[1]),i[2],(0,255,0), 2)


# draw the center of the circle cv2.circle(planets,(i[0],i[1]),2,(0,0,255),3)

4. Foreground detection with the Grab Cut algorithm

Calculating a disparity map is a useful way to segment the foreground and background of an image, but Stereos is not the
only algorithm that can accomplish this and, in fact, Stereos is more about gathering three-dimensional information from
two-dimensional pictures than anything else. Grab Cut, however, is a perfect tool for foreground/background
segmentation.
The Grab Cut algorithm consists of the following steps:
1. A rectangle including the subject(s) of the picture is defined.

2. The area lying outside the rectangle is automatically defined as a background.


3. The data contained in the background is used as a reference to distinguish background areas from foreground areas
within the user-defined rectangle.
4. A Gaussian Mixture Model (GMM) models the foreground and background, and labels undefined pixels as probable
background and probable foreground.
5. Each pixel in the image is virtually connected to the surrounding pixels through virtual edges, and each edge is
assigned a probability of being foreground or background, based on
how similar it is in color to the pixels surrounding it.
The final part of our script displays the images side by side:
plt.subplot(121) plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB)) plt.title("grabcut") plt.xticks([]) plt.yticks([])
plt.subplot(122) plt.imshow(cv2.cvtColor(original, cv2.COLOR_BGR2RGB)) plt.title("original") plt.xticks([]) plt.yticks([])
plt.show()

Page 2 of 4
5. Detecting Harris corners
Let's start by finding corners using the Harris corner detection algorithm. We will do this by implementing an example.
If you continue to study OpenCV beyond this book, you will find that chessboards are a common subject of analysis in
computer vision, partly because a checkered pattern is
suited to many types of feature detection, and partly because chess is a popular pastime, especially in Russia, where many
of OpenCV's developers live import cv2 img = cv2.imread('094.png') gray =

cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) dst = cv2.cornerHarris(gray, 2, 23, 0.04) img[dst >


0.01 * dst.max()] = [0, 0, 255] cv2_imshow(img) cv2.waitKey()

6. Detecting DoG features and extracting SIFT descriptors

You will notice how the corners are a lot more condensed; however, even though we gained some corners, we lost
others!
In particular, let's examine the Variante Ascari chicane, which looks like a squiggle at the end of the part of the track
that runs straight from northwest to southeast.
In the larger version of the image, both the entrance and the apex of the double bend were detected as corners. In the
smaller image, the apex is not detected as such. If we further reduce the image, at some scale, we will lose the entrance to
that chicane too

Matched Source

Similarity 25%
Title:High pass filter
After the initial imports, we define a 3x3 kernel and a 5x5 kernel, and then we load the image in grayscale. Normally, the
majority of image processing is done with NumPy; …
https://rsdharra.com/blog/lesson/8.html

Similarity 15%
Title:Learning OpenCV 4 Computer Vision with Python 3: Get to ...
https://books.google.com/books?id=ef_RDwAAQBAJ

Similarity 7%
Title:opencv 解决方案:errors: (-215)dims2 step0 in function locateROI
WEB · import cv2 import numpy as np from scipy import ndimage kernel_3x3 = np. array ([[-1,-1,-1], [-1, 8,-1], [-1,-1,-1]])
kernel_5x5 = np. array ([[-1,-1,-1,-1,-1], [-1, 1, 2, …
Check

Similarity 7%
Title:Learning OpenCV 4 Computer Vision with Python 3
WEBOpenCV offers a handy function called Canny (after the algorithm's inventor, John F. Canny), which is very popular not
only because of its effectiveness, but also because of …
://https%3a%2f%2fround-lake.dustinice.workers.dev%3a443%2fhttps%2fwww.jdoqocy.com%2fclick-9069228-
13722491%3furl%3dhttps%253a%252f%252fwww.oreilly.com%252flibrary%252fview%252flearning-opencv-
4%252f9781789531619%252f68d37461-b94b-4c07-85b8-23fd0065b8cc.xhtml%26afsrc%3d1%26SID%3d

Similarity 7%

Page 3 of 4
Title:Edge detection with Canny | Learning OpenCV 4 Computer Vision with ...
OpenCV offers a handy function called Canny (after the algorithm's inventor, John F. Canny), which is very popular not
only because of its effectiveness, but also because of the simplicity of its implementation in an OpenCV program since it is a
one-liner:
https://subscription.packtpub.com/book/data/9781789531619/3/ch03lvl1sec22/edge-detection-with-canny

Similarity 6%
Title:Hough lines in OpenCV/Python
... minLineLength,maxLineGap) for x1,y1,x2,y2 in lines[0]: cv2.line(img,(x1,y1),(x2,y2),(0,255,0),2) cv2.imshow('hough',img)
cv2.waitKey(0). The ...
https://stackoverflow.com/questions/33541551/hough-lines-in-opencv-python

Similarity 7%
Title:Learning OpenCV 3 Computer Vision with Python
https://books.google.com/books?id=iNlOCwAAQBAJ

Similarity 4%
Title:Python hough_ellipse Examples
circles = cv2.HoughCircles(dilate1, cv2.HOUGH_GRADIENT, 1, 120, param1=100, param2=10,
minRadius=10, maxRadius=50) circles = np.uint16(np.around(circles)) print(circles) for i in circles[0, :]: print('i', i[2]) # draw the
outer circle cv2.circle(planets, (i[0], i[1]), i[2], (0, 255, 0), 2) # draw the center of the circle cv2.circle(planets, (i ...
https://python.hotexamples.com/examples/skimage.transform/-/hough_ellipse/python-hough_ellipse-function-
examples.html

Similarity 3%
Title:www.oreilly.com › library › viewLearning OpenCV 4 Computer Vision with Python 3
If you continue to study OpenCV beyond this book, you will find that chessboards are a common subject of analysis in
computer vision, partly because a checkered pattern is suited to many types of feature detection, and partly because chess is
a popular pastime, especially in Russia, where many of OpenCV's developers live.
https://www.oreilly.com/library/view/learning-opencv-4/9781789531619/4dde73fa-3a1e-44bd-99f4-a677e2baf1e1.xhtml/

Similarity 3%
Title:Learning OpenCV 5 Computer Vision with Python, Fourth ...
import cv2 img = cv2.imread('../images/chess_board.png') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) dst =
cv2.cornerHarris(gray, 2, 23, 0.04) img[dst > ...
https://subscription.packtpub.com/book/data/9781803230221/6/ch06lvl1sec45/detecting-harris-corners

Similarity 3%
Title:Packt+ | Advance your knowledge in tech
You will notice how the corners are a lot more condensed; however, even though we gained some corners, we lost
others! In particular, let's examine the Variante Ascari chicane, which looks like a squiggle at the end of the part of
https://www.packtpub.com/en-us/product/learning-opencv-5-computer-vision-with-python-fourth-edition-fourth-edition-
6-9781803230221/chapter/retrieving-images-and-searching-using-image-descriptors/section/detecting-dog-features-and-
extracting-sift-descriptors

Page 4 of 4

You might also like