Ask Your Question

RajatGupta's profile - activity

2017-02-07 02:55:46 -0600 commented answer why imread return empty matrix

yeah if image is there then maybe path is wrong for accessing the image . Verify that the permission in your androidManifest.xml to read from external storage is correct.

2017-02-06 09:19:03 -0600 answered a question why imread return empty matrix

This happens when image is not there or path is incorrect. Can you verify if image is at the location or not . If yes try with absolute path . Still having issue share code and image .

2017-02-06 07:04:51 -0600 received badge  Editor (source)
2017-02-06 05:57:51 -0600 asked a question Problem in line detection with hough transform

I am trying to detect all the vertical lines and horizontal lines in an image . I have been able to detect all the horizontal lines successfully . But having an issue with vertical lines detection. (My first time on Opencv so don't have enough credits to upload image here ) so posting imgur link Sorry for this .

Original Image :- imgur.com/a/mZJny

After canny Edge detection

edges :- imgur.com/a/hkrve

output

o/p :- imgur.com/a/kdKwv

As you can see i have been able to detect all edges perfectly but when i am trying to detect lines with hough transform , haven't been able to do so .

Code :-

to detect vertical lines

    img = cv2.imread("sample.png")
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)


bw = cv2.adaptiveThreshold( ~gray,255,cv2.cv.CV_ADAPTIVE_THRESH_MEAN_C,        cv2.cv.CV_THRESH_BINARY,15,-2)  

vertical = np.copy(bw)
shape = 45
verticalSize = vertical.shape[0]/shape
verticalStructure = cv2.getStructuringElement(cv2.MORPH_RECT, (1, verticalSize/2))
vertical = cv2.erode(vertical, verticalStructure)
cv2.imwrite("vertical.png", vertical)
vertical = cv2.dilate(vertical, verticalStructure)
not_vertical = cv2.bitwise_not(vertical)
cv2.imwrite("vertical.png", vertical)
edges = cv2.Canny(not_vertical,50,150,apertureSize = 3)
cv2.imwrite("edges1.png", edges)
minLineLength = 4
maxLineGap = 10
lines = cv2.HoughLinesP(edges,1,np.pi/180,100,minLineLength,maxLineGap)
2015-02-12 11:30:21 -0600 asked a question Regarding Blob Extraction algorithm in openCv

I am new to opencv and i am developing a application in android and want to know how to implement Blob Extraction algorithm using openCV .