Ask Your Question

Vivek's profile - activity

2016-05-20 09:02:56 -0600 received badge  Famous Question (source)
2015-11-11 14:06:06 -0600 received badge  Notable Question (source)
2015-07-17 22:58:45 -0600 received badge  Popular Question (source)
2015-01-19 05:57:47 -0600 asked a question Objects Detection in python opencv

I am trying to detect the objects in an image and then making a rectangle around it. I followed the opencv docs and didn't got the desire output.

My code is :

import numpy as nm 
import cv2

im=cv2.imread('4.jpg')

imgray=cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)

ret,thresh = cv2.threshold(imgray,127,255,0)

contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

cnt=contours[0]

cv2.drawContours(thresh,contours,-1,(0,255,0),10)

x,y,w,h=cv2.boundingRect(cnt)

cv2.rectangle(imgray,(x,y),(x+w,y+h),(0,255,0),10)

print x,y,w,h

cv2.imshow('image',imgray)

cv2.waitKey(0)

cv2.destroyAllWindows()

Input : Input image

Output: output image

2015-01-19 05:22:15 -0600 received badge  Enthusiast
2015-01-17 07:58:52 -0600 received badge  Self-Learner (source)
2015-01-17 07:29:14 -0600 commented question opencv segmentation

Here is the snapshot of the video before and after segmentation. After Segmentation : http://postimg.org/image/c846si9q5/ Before Segmentation: http://postimg.org/image/jwr0fjahh/ Whole background is black that is fine but human body should be completely white ..

2015-01-17 07:27:15 -0600 answered a question Centroid of human person

I found the article excatly what i looking for

Here is the link

2015-01-14 08:08:11 -0600 commented question Centroid of object or What is frame in video ?

Okkk !! Sorry for inconvenience

2015-01-14 07:14:43 -0600 commented question Centroid of object or What is frame in video ?

Hey thdrksdfthmn I have only one object in my video (i.e. human person) so how can i get centroid by using frame of each capture ??

2015-01-14 06:46:06 -0600 asked a question Centroid of object or What is frame in video ?

Hello everyone ! I have a little query. I am working on video in which i applied segmentation. So i have Segmentated video and hence have each capture image frame (im.read()) . Now i need to calculate the centroid of the object, I don't know how to do that ?? Can you help me in the same ?? I think frame is nothing but the array of RGB values. If so, how to access that values ? or Any other idea how to do that in python. Thanks

2015-01-14 01:04:44 -0600 commented answer How to uninstall opencv2.4.9 completely in ubuntu 14.04

That is my question buddy ! How to remove all components to old version completely ??

2015-01-13 10:06:05 -0600 commented answer How to uninstall opencv2.4.9 completely in ubuntu 14.04

Hi thdrksdfthmn ! I followed this tutorial to install opevcv and stuck with error just before "sudo make install" .

Errors are given in this link.

2015-01-13 09:11:51 -0600 asked a question How to uninstall opencv2.4.9 completely in ubuntu 14.04

Hello guys !! I want to upgrade my opencv2.4.9 to opencv3.0 because of the features of opencv 3.0 . When i am installing opencv3.0 directly then i ended up with some HASH MISMATCH error. I think it is due to i didn't uninstall previous version ! I would be thankful if you will help me in the same. Thanks !

2015-01-13 05:32:50 -0600 commented answer opencv segmentation

Here is the snapshot of the video before and after segmentation.

After Segmentation : http://postimg.org/image/c846si9q5/

Before Segmentation: http://postimg.org/image/jwr0fjahh/

Whole background is black that is fine but human body should be completely white ..

2015-01-13 05:01:35 -0600 answered a question opencv segmentation

Hi @berak !! I format the code ! Can you help me now ?

2015-01-11 10:16:21 -0600 received badge  Editor (source)
2015-01-11 10:14:46 -0600 received badge  Supporter (source)
2015-01-11 03:36:54 -0600 asked a question Centroid of human person

Hey guys !! I m new to opencv and i m working on a project in which i have a video of a human person which is doing some activity (there is only one person in the video) . I need to calculate the centeroid of the body. I apply the segmentation and i have no idea what to do after that !! Please give me some idea how to do that if you can ! Thanks !

2015-01-11 03:36:53 -0600 asked a question opencv segmentation

I am working on a project in which i need segmentated video but after apply the segmentation to the video as given in the opencv docs , the human person i m getting is not complete white. My means of say that is there is a boundary of white pixel around the person and inside part is black and the same color as background(black). Can any one help me to obtain the completely white pixeled human person ! Thanks...

My code is :

import numpy as np 
import cv2

cap=cv2.VideoCapture('sample4.avi') 


fourcc = cv2.cv.CV_FOURCC(*'XVID')
fgbg = cv2.BackgroundSubtractorMOG()
out=cv2.VideoWriter('Segmented_Recorded_video.avi',fourcc,20.0,(640,480))


while cap.isOpened():
    ret, frame=cap.read() #capture frame by frame
    fgmask=fgbg.apply(frame)
    out.write(fgmask)

    cv2.imshow('Segmentation Video',fgmask)
    k=cv2.waitKey(30) & 0xff
    if k==27:
        break

cap.release()
out.release()
cv2.destroyAllWindows()