Re: [BangPypers] about code

2014-12-14 Thread narayan naik
Thank you,
but i already tried that,it will crop but i want to show that cropped image
on the window immediately

On Mon, Dec 15, 2014 at 12:10 PM, L Radhakrishna Rao <
satishsaga...@gmail.com> wrote:
>
> This might help you:
>
>
> http://stackoverflow.com/questions/13211745/detect-face-then-autocrop-pictures
>
> On Mon, Dec 15, 2014 at 12:00 PM, sayantan bhattacharya <
> skb655...@gmail.com
> > wrote:
> >
> > Hello,
> >
> > I haven't worked that much with openCV in python, so can't provide
> choosing
> > help right away. But searched on Google for similar topic and found the
> > following link:
> >
> >
> >
> http://stackoverflow.com/questions/13211745/detect-face-then-autocrop-pictures
> >
> > Hope this helps.
> > On Dec 15, 2014 11:52 AM, "narayan naik" 
> wrote:
> >
> > > Hi,
> > > import cv2
> > >
> > > def detect(path):
> > > img = cv2.imread(path)
> > > cascade = cv2.CascadeClassifier("haarcascade_frontalface_alt.xml")
> > > rects = cascade.detectMultiScale(img, 1.3, 4,
> > > cv2.cv.CV_HAAR_SCALE_IMAGE, (20,20))
> > >
> > > if len(rects) == 0:
> > > return [], img
> > > rects[:, 2:] += rects[:, :2]
> > > return rects, img
> > >
> > > def box(rects, img):
> > > for x1, y1, x2, y2 in rects:
> > > cv2.rectangle(img, (x1, y1), (x2, y2), (127, 255, 0), 2)
> > >
> > >
> > > rects, img = detect("hi.jpg")
> > >
> > > cropped = img[70:17, 40:40]
> > > cv2.imshow("cropped", cropped)
> > > cv2.waitKey(0)
> > > box(rects, img)
> > >
> > > cv2.imshow('img',img)
> > > cv2.waitKey(0)
> > > cv2.destroyAllWindows()
> > >
> > > This is a face detection code.This will work properly.but I want to
> crop
> > > the detected faces and it should display on the screen.
> > > ___
> > > BangPypers mailing list
> > > BangPypers@python.org
> > > https://mail.python.org/mailman/listinfo/bangpypers
> > >
> > ___
> > BangPypers mailing list
> > BangPypers@python.org
> > https://mail.python.org/mailman/listinfo/bangpypers
> >
> ___
> BangPypers mailing list
> BangPypers@python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] about code

2014-12-14 Thread narayan naik
Thank you,
but i already tried that,it will crop but i want to show that cropped image
on the window immediately

On Mon, Dec 15, 2014 at 12:00 PM, sayantan bhattacharya  wrote:
>
> Hello,
>
> I haven't worked that much with openCV in python, so can't provide choosing
> help right away. But searched on Google for similar topic and found the
> following link:
>
>
> http://stackoverflow.com/questions/13211745/detect-face-then-autocrop-pictures
>
> Hope this helps.
> On Dec 15, 2014 11:52 AM, "narayan naik"  wrote:
>
> > Hi,
> > import cv2
> >
> > def detect(path):
> > img = cv2.imread(path)
> > cascade = cv2.CascadeClassifier("haarcascade_frontalface_alt.xml")
> > rects = cascade.detectMultiScale(img, 1.3, 4,
> > cv2.cv.CV_HAAR_SCALE_IMAGE, (20,20))
> >
> > if len(rects) == 0:
> > return [], img
> > rects[:, 2:] += rects[:, :2]
> > return rects, img
> >
> > def box(rects, img):
> > for x1, y1, x2, y2 in rects:
> > cv2.rectangle(img, (x1, y1), (x2, y2), (127, 255, 0), 2)
> >
> >
> > rects, img = detect("hi.jpg")
> >
> > cropped = img[70:17, 40:40]
> > cv2.imshow("cropped", cropped)
> > cv2.waitKey(0)
> > box(rects, img)
> >
> > cv2.imshow('img',img)
> > cv2.waitKey(0)
> > cv2.destroyAllWindows()
> >
> > This is a face detection code.This will work properly.but I want to crop
> > the detected faces and it should display on the screen.
> > ___
> > BangPypers mailing list
> > BangPypers@python.org
> > https://mail.python.org/mailman/listinfo/bangpypers
> >
> ___
> BangPypers mailing list
> BangPypers@python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] about code

2014-12-14 Thread L Radhakrishna Rao
This might help you:

http://stackoverflow.com/questions/13211745/detect-face-then-autocrop-pictures

On Mon, Dec 15, 2014 at 12:00 PM, sayantan bhattacharya  wrote:
>
> Hello,
>
> I haven't worked that much with openCV in python, so can't provide choosing
> help right away. But searched on Google for similar topic and found the
> following link:
>
>
> http://stackoverflow.com/questions/13211745/detect-face-then-autocrop-pictures
>
> Hope this helps.
> On Dec 15, 2014 11:52 AM, "narayan naik"  wrote:
>
> > Hi,
> > import cv2
> >
> > def detect(path):
> > img = cv2.imread(path)
> > cascade = cv2.CascadeClassifier("haarcascade_frontalface_alt.xml")
> > rects = cascade.detectMultiScale(img, 1.3, 4,
> > cv2.cv.CV_HAAR_SCALE_IMAGE, (20,20))
> >
> > if len(rects) == 0:
> > return [], img
> > rects[:, 2:] += rects[:, :2]
> > return rects, img
> >
> > def box(rects, img):
> > for x1, y1, x2, y2 in rects:
> > cv2.rectangle(img, (x1, y1), (x2, y2), (127, 255, 0), 2)
> >
> >
> > rects, img = detect("hi.jpg")
> >
> > cropped = img[70:17, 40:40]
> > cv2.imshow("cropped", cropped)
> > cv2.waitKey(0)
> > box(rects, img)
> >
> > cv2.imshow('img',img)
> > cv2.waitKey(0)
> > cv2.destroyAllWindows()
> >
> > This is a face detection code.This will work properly.but I want to crop
> > the detected faces and it should display on the screen.
> > ___
> > BangPypers mailing list
> > BangPypers@python.org
> > https://mail.python.org/mailman/listinfo/bangpypers
> >
> ___
> BangPypers mailing list
> BangPypers@python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] about code

2014-12-14 Thread sayantan bhattacharya
Hello,

I haven't worked that much with openCV in python, so can't provide choosing
help right away. But searched on Google for similar topic and found the
following link:

http://stackoverflow.com/questions/13211745/detect-face-then-autocrop-pictures

Hope this helps.
On Dec 15, 2014 11:52 AM, "narayan naik"  wrote:

> Hi,
> import cv2
>
> def detect(path):
> img = cv2.imread(path)
> cascade = cv2.CascadeClassifier("haarcascade_frontalface_alt.xml")
> rects = cascade.detectMultiScale(img, 1.3, 4,
> cv2.cv.CV_HAAR_SCALE_IMAGE, (20,20))
>
> if len(rects) == 0:
> return [], img
> rects[:, 2:] += rects[:, :2]
> return rects, img
>
> def box(rects, img):
> for x1, y1, x2, y2 in rects:
> cv2.rectangle(img, (x1, y1), (x2, y2), (127, 255, 0), 2)
>
>
> rects, img = detect("hi.jpg")
>
> cropped = img[70:17, 40:40]
> cv2.imshow("cropped", cropped)
> cv2.waitKey(0)
> box(rects, img)
>
> cv2.imshow('img',img)
> cv2.waitKey(0)
> cv2.destroyAllWindows()
>
> This is a face detection code.This will work properly.but I want to crop
> the detected faces and it should display on the screen.
> ___
> BangPypers mailing list
> BangPypers@python.org
> https://mail.python.org/mailman/listinfo/bangpypers
>
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] about code

2014-12-14 Thread Gora Mohanty
On 15 December 2014 at 11:51, narayan naik  wrote:
[...]
> This is a face detection code.This will work properly.but I want to crop
> the detected faces and it should display on the screen.

Please ask more specific questions *after* you have tried for
yourself. Did you even try searching Google, e.g., "cv2 crop detected
faces" turns up many likely-looking links.

Regards,
Gora
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] about code

2014-12-14 Thread narayan naik
Hi,
import cv2

def detect(path):
img = cv2.imread(path)
cascade = cv2.CascadeClassifier("haarcascade_frontalface_alt.xml")
rects = cascade.detectMultiScale(img, 1.3, 4,
cv2.cv.CV_HAAR_SCALE_IMAGE, (20,20))

if len(rects) == 0:
return [], img
rects[:, 2:] += rects[:, :2]
return rects, img

def box(rects, img):
for x1, y1, x2, y2 in rects:
cv2.rectangle(img, (x1, y1), (x2, y2), (127, 255, 0), 2)


rects, img = detect("hi.jpg")

cropped = img[70:17, 40:40]
cv2.imshow("cropped", cropped)
cv2.waitKey(0)
box(rects, img)

cv2.imshow('img',img)
cv2.waitKey(0)
cv2.destroyAllWindows()

This is a face detection code.This will work properly.but I want to crop
the detected faces and it should display on the screen.
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers


[BangPypers] About code

2014-11-25 Thread narayan naik
Hi,

import numpy as np
import cv2
img=cv2.imread('4.jpg',0)
cv2.imshow('image',img)
k=cv2.waitKey(0)
if k == 27:
cv2.destroyAllWindows()
#cv2.destroyWindow('image')
elif k == ord('S'):
cv2.imwrite('image.png',img)
cv2.destroyAllWindows()

when I run this code,it is not possible to close the image window by
pressing esc key,and if going to close by using mouse the window will hang.
___
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers