Phototagging Gramphlet

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Phototagging Gramphlet

Renee S
Hi,
I know python fairly well and I like gramps so I wanted to start contributing to it. I wanted to fix the phototagging gramphlet but I'm kind of confused about what needs to be done to fix it. On the addons status page it says this: Age column missing / OpenCV needed for facedetection and its gtk3 status and python 3 status are marked as to do. I don't know what the age column is and I also dont know whether or not facedetection actually has opencv supported, as I was looking at the github and it said the last edit to facedetection was "partial update for opencv" But when I look at the comparison for before and after the change was made every line of code had been edited. Any insight on this is greatly appreciated.
Thanks!

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Phototagging Gramphlet

prculley
I have the photo tagging Gramplet installed, and it appears to work okay for me. However I don't have the opencv face detection installed. So that part of the functionality is untested by me.

I suggest you just get it installed yourself along with the opencv detection and test it as thoroughly as you can. It's possible that the add-on status page is out of date. If you find any issues go after them.

If everything seems to be working to your satisfaction, then I would let us know and we can update the status page.
Thank you for your efforts.

Paul Culley 

On Feb 21, 2017 5:57 PM, "Renee S" <[hidden email]> wrote:
Hi,
I know python fairly well and I like gramps so I wanted to start contributing to it. I wanted to fix the phototagging gramphlet but I'm kind of confused about what needs to be done to fix it. On the addons status page it says this: Age column missing / OpenCV needed for facedetection and its gtk3 status and python 3 status are marked as to do. I don't know what the age column is and I also dont know whether or not facedetection actually has opencv supported, as I was looking at the github and it said the last edit to facedetection was "partial update for opencv" But when I look at the comparison for before and after the change was made every line of code had been edited. Any insight on this is greatly appreciated.
Thanks!

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Phototagging Gramphlet

Doug-11
In reply to this post by Renee S
On 21/02/17 23:56, Renee S wrote:
Hi,
I know python fairly well and I like gramps so I wanted to start contributing to it. I wanted to fix the phototagging gramphlet but I'm kind of confused about what needs to be done to fix it. On the addons status page it says this: Age column missing / OpenCV needed for facedetection and its gtk3 status and python 3 status are marked as to do. I don't know what the age column is and I also dont know whether or not facedetection actually has opencv supported, as I was looking at the github and it said the last edit to facedetection was "partial update for opencv" But when I look at the comparison for before and after the change was made every line of code had been edited. Any insight on this is greatly appreciated.
Thanks!
Any help you can give will be invaluable - at the moment the Phototagging gramplet has suddenly become totally inoperable (please see bug #8121, recently updated).

In the past, the right-hand panel of the gramplet had a list of thumbnails of regions so far marked out; then in an adjacent column the name of each individual identified by a region; and adjacent to that, the age of the individual, calculated from his/her date of birth and the date the photograph was taken.

To the best of my knowledge, OpenCV was employed for face detection, although I never used face detection, preferring to be able to set my own boundaries for reference regions.

I'd be very happy to cooperate in any way to get this gramplet back on track. I'm an ordinary user; but probably capable of doing some simple coding under instruction.


Doug

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Phototagging Gramphlet

Doug-11
In reply to this post by prculley
Paul,

On 22/02/17 13:48, Paul Culley wrote:
I have the photo tagging Gramplet installed, and it appears to work okay for me. However I don't have the opencv face detection installed. So that part of the functionality is untested by me.

I suggest you just get it installed yourself along with the opencv detection and test it as thoroughly as you can. It's possible that the add-on status page is out of date. If you find any issues go after them.

If everything seems to be working to your satisfaction, then I would let us know and we can update the status page.
Thank you for your efforts.

Paul Culley 

On Feb 21, 2017 5:57 PM, "Renee S" <[hidden email]> wrote:
Hi,
I know python fairly well and I like gramps so I wanted to start contributing to it. I wanted to fix the phototagging gramphlet but I'm

snip>
I was very interested in your comment, given the problems I'm having (bug #8121).
What versions of gramps, etc are you using?

Doug


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Phototagging Gramphlet

Serge Noiraud-2
In reply to this post by Renee S
Le 22/02/2017 à 00:56, Renee S a écrit :
Hi,
I know python fairly well and I like gramps so I wanted to start contributing to it. I wanted to fix the phototagging gramphlet but I'm kind of confused about what needs to be done to fix it. On the addons status page it says this: Age column missing / OpenCV needed for facedetection and its gtk3 status and python 3 status are marked as to do. I don't know what the age column is and I also dont know whether or not facedetection actually has opencv supported, as I was looking at the github and it said the last edit to facedetection was "partial update for opencv" But when I look at the comparison for before and after the change was made every line of code had been edited. Any insight on this is greatly appreciated.
Thanks!
The problem is opencv which doesn't work with python3.
ubuntu and debian don't provides opencv version ftr python3.
I don't know for other distributions.

I tried to compile opencv 3.2.0.
For this I followed http://cyaninfinite.com/tutorials/installing-opencv-in-ubuntu-for-python-3/

It works great for me.
After that, we need to modify facedetection.py and PhotoTaggingGramplet.py
--- a/facedetection.py    2017-02-23 13:02:06.787603497 +0100
+++ b/facedetection.py    2017-02-24 18:30:28.603960198 +0100
@@ -57,12 +57,9 @@
 #-------------------------------------------------------------------------
 
 def detect_faces(image_path, min_face_size):
-    cv_image = cv.LoadImage(image_path, cv.CV_LOAD_IMAGE_GRAYSCALE)
-    o_width, o_height = cv_image.width, cv_image.height
-    cv.EqualizeHist(cv_image, cv_image)
-    cascade = cv.Load(HAARCASCADE_PATH)
-    faces = cv.HaarDetectObjects(cv_image, cascade,
-                                 cv.CreateMemStorage(0),
-                                 1.2, 2, cv.CV_HAAR_DO_CANNY_PRUNING,
-                                 min_face_size)
+    cv_image = cv.imread(image_path, cv.IMREAD_GRAYSCALE)
+    o_width, o_height = cv_image.shape[:2]
+    cv.equalizeHist(cv_image, cv_image)
+    cascade = cv.CascadeClassifier(HAARCASCADE_PATH)
+    faces = cascade.detectMultiScale(cv_image, 1.2, 2)
     return faces
--- a/PhotoTaggingGramplet.py    2017-02-23 13:02:06.786603508 +0100
+++ b/PhotoTaggingGramplet.py    2017-02-24 19:20:58.302565809 +0100
@@ -622,7 +622,7 @@
 
         # populate the context menu
         persons = self.all_referenced_persons()
-        if selected.person is not None:
+        if selected is not None and selected.person is not None:
             persons.remove(selected.person)
         if persons:
             self.additional_items.append(Gtk.SeparatorMenuItem())
@@ -725,7 +725,7 @@
         media = self.get_current_object()
         image_path = media_path_full(self.dbstate.db, media.get_path())
         faces = facedetection.detect_faces(image_path, MIN_FACE_SIZE)
-        for ((x, y, width, height), neighbors) in faces:
+        for (x, y, width, height) in faces:
             region = Region(x - DETECTED_REGION_PADDING,
                             y - DETECTED_REGION_PADDING,
                             x + width + DETECTED_REGION_PADDING,

We need to update haarcascade_frontalface_alt.xml to the new version.
This file is in opencv-3.2.0/samples/winrt/FaceDetection/FaceDetection/Assets/

Serge

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Phototagging Gramphlet

Doug-11
On 25/02/17 10:25, Serge Noiraud wrote:
Le 22/02/2017 à 00:56, Renee S a écrit :
Hi,
I know python fairly well and I like gramps so I wanted to start contributing to it. I wanted to fix the phototagging gramphlet but I'm kind of confused about what needs to be done to fix it. On the addons status page it says this: Age column missing / OpenCV needed for facedetection and its gtk3 status and python 3 status are marked as to do. I don't know what the age column is and I also dont know whether or not facedetection actually has opencv supported, as I was looking at the github and it said the last edit to facedetection was "partial update for opencv" But when I look at the comparison for before and after the change was made every line of code had been edited. Any insight on this is greatly appreciated.
Thanks!
The problem is opencv which doesn't work with python3.
ubuntu and debian don't provides opencv version ftr python3.
I don't know for other distributions.

I tried to compile opencv 3.2.0.
For this I followed http://cyaninfinite.com/tutorials/installing-opencv-in-ubuntu-for-python-3/

It works great for me.
After that, we need to modify facedetection.py and PhotoTaggingGramplet.py
--- a/facedetection.py    2017-02-23 13:02:06.787603497 +0100
+++ b/facedetection.py    2017-02-24 18:30:28.603960198 +0100
@@ -57,12 +57,9 @@
 #-------------------------------------------------------------------------
 
 def detect_faces(image_path, min_face_size):
-    cv_image = cv.LoadImage(image_path, cv.CV_LOAD_IMAGE_GRAYSCALE)
-    o_width, o_height = cv_image.width, cv_image.height
-    cv.EqualizeHist(cv_image, cv_image)
-    cascade = cv.Load(HAARCASCADE_PATH)
-    faces = cv.HaarDetectObjects(cv_image, cascade,
-                                 cv.CreateMemStorage(0),
-                                 1.2, 2, cv.CV_HAAR_DO_CANNY_PRUNING,
-                                 min_face_size)
+    cv_image = cv.imread(image_path, cv.IMREAD_GRAYSCALE)
+    o_width, o_height = cv_image.shape[:2]
+    cv.equalizeHist(cv_image, cv_image)
+    cascade = cv.CascadeClassifier(HAARCASCADE_PATH)
+    faces = cascade.detectMultiScale(cv_image, 1.2, 2)
     return faces
--- a/PhotoTaggingGramplet.py    2017-02-23 13:02:06.786603508 +0100
+++ b/PhotoTaggingGramplet.py    2017-02-24 19:20:58.302565809 +0100
@@ -622,7 +622,7 @@
 
         # populate the context menu
         persons = self.all_referenced_persons()
-        if selected.person is not None:
+        if selected is not None and selected.person is not None:
             persons.remove(selected.person)
         if persons:
             self.additional_items.append(Gtk.SeparatorMenuItem())
@@ -725,7 +725,7 @@
         media = self.get_current_object()
         image_path = media_path_full(self.dbstate.db, media.get_path())
         faces = facedetection.detect_faces(image_path, MIN_FACE_SIZE)
-        for ((x, y, width, height), neighbors) in faces:
+        for (x, y, width, height) in faces:
             region = Region(x - DETECTED_REGION_PADDING,
                             y - DETECTED_REGION_PADDING,
                             x + width + DETECTED_REGION_PADDING,

We need to update haarcascade_frontalface_alt.xml to the new version.
This file is in opencv-3.2.0/samples/winrt/FaceDetection/FaceDetection/Assets/

Serge

Serge,

Which gramps version are you using? I'm on 4.2.5-d1d08a1.

I'm wondering if I follow your instructions for updating opencv that should solve the problems I'm seeing or whether they're only relevant to face detection (which I don't use).
 
What about updating haarcascade_frontalface_alt.xml?


Doug
 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Phototagging Gramphlet

prculley
A (somewhat related) side question.  If we figure out how to get OpenCV support (keep up the good work Serge), but the Linux distros don't include the appropriate versions, is it possible for us to somehow include a good version with Gramps?

I know that we could do this with Josips Windows AIO, since he includes lots of pre-built libraries already, but how could this be done with Gramps For Linux, or MAC?

Maybe a script for Linux folks that downloads and installs the appropriate parts from known good locations (maybe even copies from our own Github)?

As a barely adequate Linux newbie, I struggle with finding and installing things, I hate to think what less sophisticated users would go through.

Food for thought.

Paul Culley

On Sat, Feb 25, 2017 at 7:30 AM, Doug <[hidden email]> wrote:
On 25/02/17 10:25, Serge Noiraud wrote:
Le 22/02/2017 à 00:56, Renee S a écrit :
Hi,
I know python fairly well and I like gramps so I wanted to start contributing to it. I wanted to fix the phototagging gramphlet but I'm kind of confused about what needs to be done to fix it. On the addons status page it says this: Age column missing / OpenCV needed for facedetection and its gtk3 status and python 3 status are marked as to do. I don't know what the age column is and I also dont know whether or not facedetection actually has opencv supported, as I was looking at the github and it said the last edit to facedetection was "partial update for opencv" But when I look at the comparison for before and after the change was made every line of code had been edited. Any insight on this is greatly appreciated.
Thanks!
The problem is opencv which doesn't work with python3.
ubuntu and debian don't provides opencv version ftr python3.
I don't know for other distributions.

I tried to compile opencv 3.2.0.
For this I followed http://cyaninfinite.com/tutorials/installing-opencv-in-ubuntu-for-python-3/

It works great for me.
After that, we need to modify facedetection.py and PhotoTaggingGramplet.py
--- a/facedetection.py    2017-02-23 13:02:06.787603497 +0100
+++ b/facedetection.py    2017-02-24 18:30:28.603960198 +0100
@@ -57,12 +57,9 @@
 #-------------------------------------------------------------------------
 
 def detect_faces(image_path, min_face_size):
-    cv_image = cv.LoadImage(image_path, cv.CV_LOAD_IMAGE_GRAYSCALE)
-    o_width, o_height = cv_image.width, cv_image.height
-    cv.EqualizeHist(cv_image, cv_image)
-    cascade = cv.Load(HAARCASCADE_PATH)
-    faces = cv.HaarDetectObjects(cv_image, cascade,
-                                 cv.CreateMemStorage(0),
-                                 1.2, 2, cv.CV_HAAR_DO_CANNY_PRUNING,
-                                 min_face_size)
+    cv_image = cv.imread(image_path, cv.IMREAD_GRAYSCALE)
+    o_width, o_height = cv_image.shape[:2]
+    cv.equalizeHist(cv_image, cv_image)
+    cascade = cv.CascadeClassifier(HAARCASCADE_PATH)
+    faces = cascade.detectMultiScale(cv_image, 1.2, 2)
     return faces
--- a/PhotoTaggingGramplet.py    2017-02-23 13:02:06.786603508 +0100
+++ b/PhotoTaggingGramplet.py    2017-02-24 19:20:58.302565809 +0100
@@ -622,7 +622,7 @@
 
         # populate the context menu
         persons = self.all_referenced_persons()
-        if selected.person is not None:
+        if selected is not None and selected.person is not None:
             persons.remove(selected.person)
         if persons:
             self.additional_items.append(Gtk.SeparatorMenuItem())
@@ -725,7 +725,7 @@
         media = self.get_current_object()
         image_path = media_path_full(self.dbstate.db, media.get_path())
         faces = facedetection.detect_faces(image_path, MIN_FACE_SIZE)
-        for ((x, y, width, height), neighbors) in faces:
+        for (x, y, width, height) in faces:
             region = Region(x - DETECTED_REGION_PADDING,
                             y - DETECTED_REGION_PADDING,
                             x + width + DETECTED_REGION_PADDING,

We need to update haarcascade_frontalface_alt.xml to the new version.
This file is in opencv-3.2.0/samples/winrt/FaceDetection/FaceDetection/Assets/

Serge

Serge,

Which gramps version are you using? I'm on 4.2.5-d1d08a1.

I'm wondering if I follow your instructions for updating opencv that should solve the problems I'm seeing or whether they're only relevant to face detection (which I don't use).
 
What about updating haarcascade_frontalface_alt.xml?


Doug
 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Phototagging Gramphlet

Paul Franklin-5
> A (somewhat related) side question.  If we figure out how to get OpenCV
> support (keep up the good work Serge), but the Linux distros don't include
> the appropriate versions, is it possible for us to somehow include a good
> version with Gramps?

I don't run the Phototagging gramplet so in that sense
what is done will not affect me, but I don't like the idea
of gramps getting into the "distro" business, distributing
binary object files that gramps needs, somehow.

IMHO if we think some version of something should be
made for python3 we should submit a request to our
distro for one of their package maintainers to make it.

That's certainly what I did back when we transitioned
from Python2 to Python3 and from Gtk2 to Gtk3, since
several packages which existed for Debian/Ubuntu
developers weren't available on my distro (Fedora).

Mind you, I compiled them for myself.  That wasn't
the problem.  The problem was for our users (on my
dsitro) would would need those packages, once
we released gramps 4.0.0.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Phototagging Gramphlet

Josip
In reply to this post by prculley
25.2.2017. u 16:19, Paul Culley je napisao/la:

> A (somewhat related) side question.  If we figure out how to get OpenCV
> support (keep up the good work Serge), but the Linux distros don't include
> the appropriate versions, is it possible for us to somehow include a good
> version with Gramps?
>
> I know that we could do this with Josips Windows AIO, since he includes
> lots of pre-built libraries already, but how could this be done with Gramps
> For Linux, or MAC?
>
> Maybe a script for Linux folks that downloads and installs the appropriate
> parts from known good locations (maybe even copies from our own Github)?
>
> As a barely adequate Linux newbie, I struggle with finding and installing
> things, I hate to think what less sophisticated users would go through.

OpenCV is to big and have too many dependencies to be included in any
package.
But why it should be included anyway?
It is used only in phototagging gramplet to detect presence of faces and
eyes on image (big deal, if you can't see that this is face then how you
would know is aunt Martha face and tag-git as such ). Unless some expert
on facial recognition write something useful with OpenCV for us we need
him as much as we need WebKitGTK in HtmlView gramplet.

Real problem with PhotoTagging gramplet is more like
ReferenceMediaEditor one. It response badly to window resize so region
selection often not works.

--
Josip

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Phototagging Gramphlet

Serge Noiraud-2
In reply to this post by Doug-11
Le 25/02/2017 à 14:30, Doug a écrit :
On 25/02/17 10:25, Serge Noiraud wrote:
Le 22/02/2017 à 00:56, Renee S a écrit :
Hi,
I know python fairly well and I like gramps so I wanted to start contributing to it. I wanted to fix the phototagging gramphlet but I'm kind of confused about what needs to be done to fix it. On the addons status page it says this: Age column missing / OpenCV needed for facedetection and its gtk3 status and python 3 status are marked as to do. I don't know what the age column is and I also dont know whether or not facedetection actually has opencv supported, as I was looking at the github and it said the last edit to facedetection was "partial update for opencv" But when I look at the comparison for before and after the change was made every line of code had been edited. Any insight on this is greatly appreciated.
Thanks!
The problem is opencv which doesn't work with python3.
ubuntu and debian don't provides opencv version ftr python3.
I don't know for other distributions.

I tried to compile opencv 3.2.0.
For this I followed http://cyaninfinite.com/tutorials/installing-opencv-in-ubuntu-for-python-3/

It works great for me.
After that, we need to modify facedetection.py and PhotoTaggingGramplet.py
--- a/facedetection.py    2017-02-23 13:02:06.787603497 +0100
+++ b/facedetection.py    2017-02-24 18:30:28.603960198 +0100
@@ -57,12 +57,9 @@
 #-------------------------------------------------------------------------
 
 def detect_faces(image_path, min_face_size):
-    cv_image = cv.LoadImage(image_path, cv.CV_LOAD_IMAGE_GRAYSCALE)
-    o_width, o_height = cv_image.width, cv_image.height
-    cv.EqualizeHist(cv_image, cv_image)
-    cascade = cv.Load(HAARCASCADE_PATH)
-    faces = cv.HaarDetectObjects(cv_image, cascade,
-                                 cv.CreateMemStorage(0),
-                                 1.2, 2, cv.CV_HAAR_DO_CANNY_PRUNING,
-                                 min_face_size)
+    cv_image = cv.imread(image_path, cv.IMREAD_GRAYSCALE)
+    o_width, o_height = cv_image.shape[:2]
+    cv.equalizeHist(cv_image, cv_image)
+    cascade = cv.CascadeClassifier(HAARCASCADE_PATH)
+    faces = cascade.detectMultiScale(cv_image, 1.2, 2)
     return faces
--- a/PhotoTaggingGramplet.py    2017-02-23 13:02:06.786603508 +0100
+++ b/PhotoTaggingGramplet.py    2017-02-24 19:20:58.302565809 +0100
@@ -622,7 +622,7 @@
 
         # populate the context menu
         persons = self.all_referenced_persons()
-        if selected.person is not None:
+        if selected is not None and selected.person is not None:
             persons.remove(selected.person)
         if persons:
             self.additional_items.append(Gtk.SeparatorMenuItem())
@@ -725,7 +725,7 @@
         media = self.get_current_object()
         image_path = media_path_full(self.dbstate.db, media.get_path())
         faces = facedetection.detect_faces(image_path, MIN_FACE_SIZE)
-        for ((x, y, width, height), neighbors) in faces:
+        for (x, y, width, height) in faces:
             region = Region(x - DETECTED_REGION_PADDING,
                             y - DETECTED_REGION_PADDING,
                             x + width + DETECTED_REGION_PADDING,

We need to update haarcascade_frontalface_alt.xml to the new version.
This file is in opencv-3.2.0/samples/winrt/FaceDetection/FaceDetection/Assets/

Serge

Serge,

Which gramps version are you using? I'm on 4.2.5-d1d08a1.
I use 4.2.6-8c7133a but it should work with 4.2.5

I'm wondering if I follow your instructions for updating opencv that should solve the problems I'm seeing or whether they're only relevant to face detection (which I don't use).
This solves the face detection. I suppose you spoke about the age column ? (bug 8121)
 
What about updating haarcascade_frontalface_alt.xml?
I'm not sure it will works. The files are very differents.


Doug
 

Serge


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Phototagging Gramphlet

Serge Noiraud-2
In reply to this post by Paul Franklin-5
Le 25/02/2017 à 17:10, Paul Franklin a écrit :

>> A (somewhat related) side question.  If we figure out how to get OpenCV
>> support (keep up the good work Serge), but the Linux distros don't include
>> the appropriate versions, is it possible for us to somehow include a good
>> version with Gramps?
> I don't run the Phototagging gramplet so in that sense
> what is done will not affect me, but I don't like the idea
> of gramps getting into the "distro" business, distributing
> binary object files that gramps needs, somehow.
>
> IMHO if we think some version of something should be
> made for python3 we should submit a request to our
> distro for one of their package maintainers to make it.
I agree for that, this is not the gramps developpers job!
Perhaps ron may help us for that for debian and ubuntu.

>
> That's certainly what I did back when we transitioned
> from Python2 to Python3 and from Gtk2 to Gtk3, since
> several packages which existed for Debian/Ubuntu
> developers weren't available on my distro (Fedora).
>
> Mind you, I compiled them for myself.  That wasn't
> the problem.  The problem was for our users (on my
> dsitro) would would need those packages, once
> we released gramps 4.0.0.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Gramps-users] Phototagging Gramphlet

Doug-11
In reply to this post by Serge Noiraud-2
On 26/02/17 16:22, Doug wrote:

> On 25/02/17 18:40, Serge Noiraud wrote:
>> Le 25/02/2017 à  14:30, Doug a écrit :
>>> On 25/02/17 10:25, Serge Noiraud wrote:
>>>> Le 22/02/2017 ÃÂ  00:56, Renee S a écritÂÂ :
>>>>> Hi,
>>>>> I know python fairly well and I like gramps so I wanted
>>>>> to start contributing to it. I wanted to fix the
>>>>> phototagging gramphlet but I'm kind of confused about
>>>>> what needs to be done to fix it. On the addons status
>>>>> page it says this: Age column missing / OpenCV needed
>>>>> for facedetection and its gtk3 status and python 3
>>>>> status are marked as to do. I don't know what the age
>>>>> column is and I also dont know whether or not
>>>>> facedetection actually has opencv supported, as I was
>>>>> looking at the github and it said the last edit to
>>>>> facedetection was "partial update for opencv" But when I
>>>>> look at the comparison for before and after the change
>>>>> was made every line of code had been edited. Any insight
>>>>> on this is greatly appreciated.
>>>>> Thanks!
>>>> The problem is opencv which doesn't work with python3.
>>>> ubuntu and debian don't provides opencv version ftr python3.
>>>> I don't know for other distributions.
>>>>
>>>> I tried to compile opencv 3.2.0.
>>>> For this I followed
>>>> http://cyaninfinite.com/tutorials/installing-opencv-in-ubuntu-for-python-3/
>>>>
>>>> It works great for me.
>>>> After that, we need to modify facedetection.py and
>>>> PhotoTaggingGramplet.py
>>>> --- a/facedetection.pyÂÂ ÂÂ ÂÂ  2017-02-23
>>>> 13:02:06.787603497 +0100
>>>> +++ b/facedetection.pyÂÂ ÂÂ ÂÂ  2017-02-24
>>>> 18:30:28.603960198 +0100
>>>> @@ -57,12 +57,9 @@
>>>>  #-------------------------------------------------------------------------
>>>> ÂÂ
>>>>  def detect_faces(image_path, min_face_size):
>>>> -ÂÂ ÂÂ ÂÂ  cv_image = cv.LoadImage(image_path,
>>>> cv.CV_LOAD_IMAGE_GRAYSCALE)
>>>> -ÂÂ ÂÂ ÂÂ  o_width, o_height = cv_image.width,
>>>> cv_image.height
>>>> -ÂÂ ÂÂ ÂÂ  cv.EqualizeHist(cv_image, cv_image)
>>>> -ÂÂ ÂÂ ÂÂ  cascade = cv.Load(HAARCASCADE_PATH)
>>>> -ÂÂ ÂÂ ÂÂ  faces = cv.HaarDetectObjects(cv_image,
>>>> cascade,
>>>> -                               ÂÂ
>>>> cv.CreateMemStorage(0),
>>>> -                               ÂÂ
>>>> 1.2, 2, cv.CV_HAAR_DO_CANNY_PRUNING,
>>>> -                               ÂÂ
>>>> min_face_size)
>>>> +ÂÂ ÂÂ ÂÂ  cv_image = cv.imread(image_path,
>>>> cv.IMREAD_GRAYSCALE)
>>>> +ÂÂ ÂÂ ÂÂ  o_width, o_height = cv_image.shape[:2]
>>>> +ÂÂ ÂÂ ÂÂ  cv.equalizeHist(cv_image, cv_image)
>>>> +ÂÂ ÂÂ ÂÂ  cascade =
>>>> cv.CascadeClassifier(HAARCASCADE_PATH)
>>>> +ÂÂ ÂÂ ÂÂ  faces = cascade.detectMultiScale(cv_image,
>>>> 1.2, 2)
>>>> ÂÂ ÂÂ ÂÂ ÂÂ  return faces
>>>> --- a/PhotoTaggingGramplet.pyÂÂ ÂÂ ÂÂ  2017-02-23
>>>> 13:02:06.786603508 +0100
>>>> +++ b/PhotoTaggingGramplet.pyÂÂ ÂÂ ÂÂ  2017-02-24
>>>> 19:20:58.302565809 +0100
>>>> @@ -622,7 +622,7 @@
>>>> ÂÂ
>>>> ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ  # populate the context menu
>>>> ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ  persons =
>>>> self.all_referenced_persons()
>>>> -ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ  if selected.person is not None:
>>>> +ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ  if selected is not None and
>>>> selected.person is not None:
>>>>            ÂÂ
>>>> persons.remove(selected.person)
>>>> ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ  if persons:
>>>>            ÂÂ
>>>> self.additional_items.append(Gtk.SeparatorMenuItem())
>>>> @@ -725,7 +725,7 @@
>>>> ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ  media =
>>>> self.get_current_object()
>>>> ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ  image_path =
>>>> media_path_full(self.dbstate.db, media.get_path())
>>>> ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ  faces =
>>>> facedetection.detect_faces(image_path, MIN_FACE_SIZE)
>>>> -ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ  for ((x, y, width, height),
>>>> neighbors) in faces:
>>>> +ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ  for (x, y, width, height)
>>>> in faces:
>>>> ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ ÂÂ  region =
>>>> Region(x - DETECTED_REGION_PADDING,
>>>>                            ÂÂ
>>>> y - DETECTED_REGION_PADDING,
>>>>                            ÂÂ
>>>> x + width + DETECTED_REGION_PADDING,
>>>>
>>>> We need to update haarcascade_frontalface_alt.xml to the
>>>> new version.
>>>> This file is in
>>>> opencv-3.2.0/samples/winrt/FaceDetection/FaceDetection/Assets/
>>>>
>>>> Serge
>>> Serge,
>>>
>>> Which gramps version are you using? I'm on 4.2.5-d1d08a1.
>> I use 4.2.6-8c7133a but it should work with 4.2.5
>>> I'm wondering if I follow your instructions for updating
>>> opencv that should solve the problems I'm seeing or
>>> whether they're only relevant to face detection (which I
>>> don't use).
>> This solves the face detection. I suppose you spoke about
>> the age column ? (bug 8121)
> No, that wasn't my problem (at least as far as I remember
> the age column was present when phototagging was last working).
>
> My problem got merged with #8121, but in fact it was similar
> to Josip's:

P.S. Apart from the fact that it now doesn't seem to work at all
<snip>

Doug

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gramps-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gramps-devel
Loading...