Image annotation with landmarks

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Image annotation with landmarks

opencv-users mailing list
 Hi all,Can any one tell me how to annotate an image with interesting points and how to save the coordinates of these points in XML file.
best wishes,
Nora,
Reply | Threaded
Open this post in threaded view
|

Re: Image annotation with landmarks

opencv-users mailing list
I don’t understand what you mean by “annotate an image with interesting points and save the coordinates into xml file”! There is several ways to annotate images. Do you already have the interesting points and you want to save their coordinates in XML files? In this case, an easy way is to create an 2D matrix (/image) of size N*2  (N= number of rows=number of interesting points, 2: number of columns) and save the coordinates to this matrix, then save the matrix in xml format using cvSave(“name_of_your_matrix.xml”, your_matrix) if you are writing your code in “C”, or .save(….) in CPP. (see the opencv reference manual)
 If, for example, you want to detect interesting points to use for object tracking, opencv provides many algorithms for doing this, such as harris corner detector used in SIFT …
 Cordially,
 Lotfi HOCINI
Reply | Threaded
Open this post in threaded view
|

Re: Image annotation with landmarks [1 Attachment]

opencv-users mailing list
many thanks Lotfi I want to click some points by mouse on the face image. for example on the (mouth, eyes,...,etc). then save the  points  coordinate in xml file. like the active shape model(ASM). look the attached file 


      From: "[hidden email] [OpenCV]" <[hidden email]>
 To: [hidden email]
 Sent: Wednesday, 1 April 2015, 11:04
 Subject: [OpenCV] Re: Image annotation with landmarks
   
    I don’t understandwhat you mean by “annotate an image with interestingpoints and save the coordinates into xml file”! There is several ways toannotate images. Do you already have the interesting points and you want tosave their coordinates in XML files? In this case, an easy way is to create an2D matrix (/image) of size N*2  (N= numberof rows=number of interesting points, 2: number of columns) and save the coordinatesto this matrix, then save the matrix in xml format using cvSave(“name_of_your_matrix.xml”,your_matrix) if you are writing your code in “C”, or .save(….) in CPP. (see theopencv reference manual)If, forexample, you want to detect interesting points to use for object tracking, opencvprovides many algorithms for doing this, such as harris corner detector used inSIFT …Cordially,Lotfi HOCINI  #yiv3002018263 #yiv3002018263 -- #yiv3002018263ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv3002018263 #yiv3002018263ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv3002018263 #yiv3002018263ygrp-mkp #yiv3002018263hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv3002018263 #yiv3002018263ygrp-mkp #yiv3002018263ads {margin-bottom:10px;}#yiv3002018263 #yiv3002018263ygrp-mkp .yiv3002018263ad {padding:0 0;}#yiv3002018263 #yiv3002018263ygrp-mkp .yiv3002018263ad p {margin:0;}#yiv3002018263 #yiv3002018263ygrp-mkp .yiv3002018263ad a {color:#0000ff;text-decoration:none;}#yiv3002018263 #yiv3002018263ygrp-sponsor #yiv3002018263ygrp-lc {font-family:Arial;}#yiv3002018263 #yiv3002018263ygrp-sponsor #yiv3002018263ygrp-lc #yiv3002018263hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv3002018263 #yiv3002018263ygrp-sponsor #yiv3002018263ygrp-lc .yiv3002018263ad {margin-bottom:10px;padding:0 0;}#yiv3002018263 #yiv3002018263actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv3002018263 #yiv3002018263activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv3002018263 #yiv3002018263activity span {font-weight:700;}#yiv3002018263 #yiv3002018263activity span:first-child {text-transform:uppercase;}#yiv3002018263 #yiv3002018263activity span a {color:#5085b6;text-decoration:none;}#yiv3002018263 #yiv3002018263activity span span {color:#ff7900;}#yiv3002018263 #yiv3002018263activity span .yiv3002018263underline {text-decoration:underline;}#yiv3002018263 .yiv3002018263attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv3002018263 .yiv3002018263attach div a {text-decoration:none;}#yiv3002018263 .yiv3002018263attach img {border:none;padding-right:5px;}#yiv3002018263 .yiv3002018263attach label {display:block;margin-bottom:5px;}#yiv3002018263 .yiv3002018263attach label a {text-decoration:none;}#yiv3002018263 blockquote {margin:0 0 0 4px;}#yiv3002018263 .yiv3002018263bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv3002018263 .yiv3002018263bold a {text-decoration:none;}#yiv3002018263 dd.yiv3002018263last p a {font-family:Verdana;font-weight:700;}#yiv3002018263 dd.yiv3002018263last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv3002018263 dd.yiv3002018263last p span.yiv3002018263yshortcuts {margin-right:0;}#yiv3002018263 div.yiv3002018263attach-table div div a {text-decoration:none;}#yiv3002018263 div.yiv3002018263attach-table {width:400px;}#yiv3002018263 div.yiv3002018263file-title a, #yiv3002018263 div.yiv3002018263file-title a:active, #yiv3002018263 div.yiv3002018263file-title a:hover, #yiv3002018263 div.yiv3002018263file-title a:visited {text-decoration:none;}#yiv3002018263 div.yiv3002018263photo-title a, #yiv3002018263 div.yiv3002018263photo-title a:active, #yiv3002018263 div.yiv3002018263photo-title a:hover, #yiv3002018263 div.yiv3002018263photo-title a:visited {text-decoration:none;}#yiv3002018263 div#yiv3002018263ygrp-mlmsg #yiv3002018263ygrp-msg p a span.yiv3002018263yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv3002018263 .yiv3002018263green {color:#628c2a;}#yiv3002018263 .yiv3002018263MsoNormal {margin:0 0 0 0;}#yiv3002018263 o {font-size:0;}#yiv3002018263 #yiv3002018263photos div {float:left;width:72px;}#yiv3002018263 #yiv3002018263photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv3002018263 #yiv3002018263photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv3002018263 #yiv3002018263reco-category {font-size:77%;}#yiv3002018263 #yiv3002018263reco-desc {font-size:77%;}#yiv3002018263 .yiv3002018263replbq {margin:4px;}#yiv3002018263 #yiv3002018263ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv3002018263 #yiv3002018263ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv3002018263 #yiv3002018263ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv3002018263 #yiv3002018263ygrp-mlmsg select, #yiv3002018263 input, #yiv3002018263 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv3002018263 #yiv3002018263ygrp-mlmsg pre, #yiv3002018263 code {font:115% monospace;}#yiv3002018263 #yiv3002018263ygrp-mlmsg * {line-height:1.22em;}#yiv3002018263 #yiv3002018263ygrp-mlmsg #yiv3002018263logo {padding-bottom:10px;}#yiv3002018263 #yiv3002018263ygrp-msg p a {font-family:Verdana;}#yiv3002018263 #yiv3002018263ygrp-msg p#yiv3002018263attach-count span {color:#1E66AE;font-weight:700;}#yiv3002018263 #yiv3002018263ygrp-reco #yiv3002018263reco-head {color:#ff7900;font-weight:700;}#yiv3002018263 #yiv3002018263ygrp-reco {margin-bottom:20px;padding:0px;}#yiv3002018263 #yiv3002018263ygrp-sponsor #yiv3002018263ov li a {font-size:130%;text-decoration:none;}#yiv3002018263 #yiv3002018263ygrp-sponsor #yiv3002018263ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv3002018263 #yiv3002018263ygrp-sponsor #yiv3002018263ov ul {margin:0;padding:0 0 0 8px;}#yiv3002018263 #yiv3002018263ygrp-text {font-family:Georgia;}#yiv3002018263 #yiv3002018263ygrp-text p {margin:0 0 1em 0;}#yiv3002018263 #yiv3002018263ygrp-text tt {font-size:120%;}#yiv3002018263 #yiv3002018263ygrp-vital ul li:last-child {border-right:none !important;}#yiv3002018263

 
Reply | Threaded
Open this post in threaded view
|

Re: Image annotation with landmarks

opencv-users mailing list
Hello NoraI wrote youa simple program (below) that explains how to use a  mouse callback function; Copy the code and enjoy (you have just tomodify the image path).When you makeclicks on the image (mouse left button), the coordinates of the corresponding pointswill be displayed in the consol. Finally, you have just to press any key on thekeyboard and the coordinates will be saved in an xml file.   See alsothe code that I made as comment for loading the saved points in a futureprogram.
#include<iostream>#include<opencv2/core/core.hpp>#include<opencv2/highgui/highgui.hpp>usingnamespace std;usingnamespace cv;vector<Point2i>  intersting_points; voidMouse_callback(int mousse_event, int x, int y,int flags, void*){                 if (mousse_event==CV_EVENT_LBUTTONDOWN) // left button clic                 {                                  intersting_points.push_back(Point2i(x,y));                                  cout<<Point2i(x,y)<<endl;                 }}voidmain(){                                  Mat img=imread("my_image.jpg");                 namedWindow("windows_name");                 imshow("windows_name",img);                 FileStorage fs("intersting_points.XML",FileStorage::WRITE);                   setMouseCallback("windows_name",Mouse_callback,0);                        waitKey();                   fs<<"intersting_points"<<intersting_points;                   // The code below is for loading the saved coordinates in a future program,                 //you have just to copy it                    /*                   //To load the stored file                    FileStoragefs("intersting_points.XML", FileStorage::READ);                     vector<Point2i>  intersting_points;                  fs["intersting_points"]>>intersting_points;                   cout<<"intersting points="<<intersting_points<<endl;                */             }
Cordially;Lotfi HOCINI


     Le Jeudi 2 avril 2015 22h39, "NORA SAHIB [hidden email] [OpenCV]" <[hidden email]> a écrit :
   

    

 [Attachment(s) from NORA SAHIB included below] many thanks Lotfi I want to click some points by mouse on the face image. for example on the (mouth, eyes,...,etc). then save the  points  coordinate in xml file. like the active shape model(ASM). look the attached file 


      From: "[hidden email] [OpenCV]" <[hidden email]>
 To: [hidden email]
 Sent: Wednesday, 1 April 2015, 11:04
 Subject: [OpenCV] Re: Image annotation with landmarks
   
    I don’t understandwhat you mean by “annotate an image with interestingpoints and save the coordinates into xml file”! There is several ways toannotate images. Do you already have the interesting points and you want tosave their coordinates in XML files? In this case, an easy way is to create an2D matrix (/image) of size N*2  (N= numberof rows=number of interesting points, 2: number of columns) and save the coordinatesto this matrix, then save the matrix in xml format using cvSave(“name_of_your_matrix.xml”,your_matrix) if you are writing your code in “C”, or .save(….) in CPP. (see theopencv reference manual)If, forexample, you want to detect interesting points to use for object tracking, opencvprovides many algorithms for doing this, such as harris corner detector used inSIFT …Cordially,Lotfi HOCINI  

     #yiv2957832332 -- #yiv2957832332ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv2957832332 #yiv2957832332ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv2957832332 #yiv2957832332ygrp-mkp #yiv2957832332hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv2957832332 #yiv2957832332ygrp-mkp #yiv2957832332ads {margin-bottom:10px;}#yiv2957832332 #yiv2957832332ygrp-mkp .yiv2957832332ad {padding:0 0;}#yiv2957832332 #yiv2957832332ygrp-mkp .yiv2957832332ad p {margin:0;}#yiv2957832332 #yiv2957832332ygrp-mkp .yiv2957832332ad a {color:#0000ff;text-decoration:none;}#yiv2957832332 #yiv2957832332ygrp-sponsor #yiv2957832332ygrp-lc {font-family:Arial;}#yiv2957832332 #yiv2957832332ygrp-sponsor #yiv2957832332ygrp-lc #yiv2957832332hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv2957832332 #yiv2957832332ygrp-sponsor #yiv2957832332ygrp-lc .yiv2957832332ad {margin-bottom:10px;padding:0 0;}#yiv2957832332 #yiv2957832332actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv2957832332 #yiv2957832332activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv2957832332 #yiv2957832332activity span {font-weight:700;}#yiv2957832332 #yiv2957832332activity span:first-child {text-transform:uppercase;}#yiv2957832332 #yiv2957832332activity span a {color:#5085b6;text-decoration:none;}#yiv2957832332 #yiv2957832332activity span span {color:#ff7900;}#yiv2957832332 #yiv2957832332activity span .yiv2957832332underline {text-decoration:underline;}#yiv2957832332 .yiv2957832332attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv2957832332 .yiv2957832332attach div a {text-decoration:none;}#yiv2957832332 .yiv2957832332attach img {border:none;padding-right:5px;}#yiv2957832332 .yiv2957832332attach label {display:block;margin-bottom:5px;}#yiv2957832332 .yiv2957832332attach label a {text-decoration:none;}#yiv2957832332 blockquote {margin:0 0 0 4px;}#yiv2957832332 .yiv2957832332bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv2957832332 .yiv2957832332bold a {text-decoration:none;}#yiv2957832332 dd.yiv2957832332last p a {font-family:Verdana;font-weight:700;}#yiv2957832332 dd.yiv2957832332last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv2957832332 dd.yiv2957832332last p span.yiv2957832332yshortcuts {margin-right:0;}#yiv2957832332 div.yiv2957832332attach-table div div a {text-decoration:none;}#yiv2957832332 div.yiv2957832332attach-table {width:400px;}#yiv2957832332 div.yiv2957832332file-title a, #yiv2957832332 div.yiv2957832332file-title a:active, #yiv2957832332 div.yiv2957832332file-title a:hover, #yiv2957832332 div.yiv2957832332file-title a:visited {text-decoration:none;}#yiv2957832332 div.yiv2957832332photo-title a, #yiv2957832332 div.yiv2957832332photo-title a:active, #yiv2957832332 div.yiv2957832332photo-title a:hover, #yiv2957832332 div.yiv2957832332photo-title a:visited {text-decoration:none;}#yiv2957832332 div#yiv2957832332ygrp-mlmsg #yiv2957832332ygrp-msg p a span.yiv2957832332yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv2957832332 .yiv2957832332green {color:#628c2a;}#yiv2957832332 .yiv2957832332MsoNormal {margin:0 0 0 0;}#yiv2957832332 o {font-size:0;}#yiv2957832332 #yiv2957832332photos div {float:left;width:72px;}#yiv2957832332 #yiv2957832332photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv2957832332 #yiv2957832332photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv2957832332 #yiv2957832332reco-category {font-size:77%;}#yiv2957832332 #yiv2957832332reco-desc {font-size:77%;}#yiv2957832332 .yiv2957832332replbq {margin:4px;}#yiv2957832332 #yiv2957832332ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv2957832332 #yiv2957832332ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv2957832332 #yiv2957832332ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv2957832332 #yiv2957832332ygrp-mlmsg select, #yiv2957832332 input, #yiv2957832332 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv2957832332 #yiv2957832332ygrp-mlmsg pre, #yiv2957832332 code {font:115% monospace;}#yiv2957832332 #yiv2957832332ygrp-mlmsg * {line-height:1.22em;}#yiv2957832332 #yiv2957832332ygrp-mlmsg #yiv2957832332logo {padding-bottom:10px;}#yiv2957832332 #yiv2957832332ygrp-msg p a {font-family:Verdana;}#yiv2957832332 #yiv2957832332ygrp-msg p#yiv2957832332attach-count span {color:#1E66AE;font-weight:700;}#yiv2957832332 #yiv2957832332ygrp-reco #yiv2957832332reco-head {color:#ff7900;font-weight:700;}#yiv2957832332 #yiv2957832332ygrp-reco {margin-bottom:20px;padding:0px;}#yiv2957832332 #yiv2957832332ygrp-sponsor #yiv2957832332ov li a {font-size:130%;text-decoration:none;}#yiv2957832332 #yiv2957832332ygrp-sponsor #yiv2957832332ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv2957832332 #yiv2957832332ygrp-sponsor #yiv2957832332ov ul {margin:0;padding:0 0 0 8px;}#yiv2957832332 #yiv2957832332ygrp-text {font-family:Georgia;}#yiv2957832332 #yiv2957832332ygrp-text p {margin:0 0 1em 0;}#yiv2957832332 #yiv2957832332ygrp-text tt {font-size:120%;}#yiv2957832332 #yiv2957832332ygrp-vital ul li:last-child {border-right:none !important;}#yiv2957832332