Harit Ahuja
Harit Ahuja

Reputation: 335

What does corner.ravel() does?

I couldn't understand the use of corner.ravel() in a source code regarding corner detection.

Here is the corresponding source code:

import numpy as np
import cv2
from matplotlib import pyplot as plt

img = cv2.imread('simple.jpg')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

corners = cv2.goodFeaturesToTrack(gray,25,0.01,10)
corners = np.int0(corners)

for corner in corners:
    x,y = corner.ravel()
    cv2.circle(img,(x,y),3,255,-1)

plt.imshow(img),plt.show()

If someone can explain, it will be great help. Thank You!

Upvotes: 1

Views: 1308

Answers (1)

ZdaR
ZdaR

Reputation: 22954

.ravel(), is an attribute to numpy matrices, which can be used to faltten the src Matrix, there are other similar APIs' as well which can be used for this purpose such as : .flatten(), .reshape()

Upvotes: 3

Related Questions