Home > Software engineering >  MFC how to acquire images of GPS information?
MFC how to acquire images of GPS information?

Time:09-15

CodePudding user response:

B: what kind of pictures posted a see if

CodePudding user response:

reference 1st floor zgl7903 response:
what kind of pictures posted a come out to see?

Is the mobile phone of the kind, with geographical location

CodePudding user response:

Before this problem I really know, because I have studied the direction of the image information,

In general, some devices will take pictures with "direction, equipment, time, location, location" and so on information, the information referred to as EXIF information, specific to baidu, then recommend an online photo EXIF information website, for example, I posted a iPhone6 picture taken, can resolve the contains a large amount of additional information, including the original poster wants to know the GPS information, as shown in figure:



On the following code, using MFC GDI + relevant graphics interface:
 
The Image * pImg=Image: : FromFile (_T (" F: \ \ multimedia material \ \ Photos \ \ IMG_0166 JPG "), FALSE);
If (pImg) {
PropertyItem * PropertyItem=NULL;
UINT size=pImg - & gt; GetPropertyItemSize (PropertyTagGpsLatitudeRef);
If (size) {
PropertyItem=(propertyItem *) malloc (size);
If (propertyItem) {
The Status stGet=pImg - & gt; GetPropertyItem (PropertyTagGpsLatitudeRef, size, propertyItem);
If ((stGet==Status: : Ok) & amp; & (propertyItem - & gt; Value)) {
Char * (char *) propertyItem pValue=https://bbs.csdn.net/topics/-> value;//note here, turn different attribute of the strong have different types of
}
Delete the propertyItem;
PropertyItem=NULL;
}
}
The delete pImg;
PImg=NULL;
}


Including PropertyTagGpsLatitudeRef in gdiplusimaging. H is defined, and many, many, but the original poster need GPS related as many as 31 kinds:
 
# define PropertyTagGpsVer 0 x0000
# define PropertyTagGpsLatitudeRef 0 x0001
# define PropertyTagGpsLatitude 0 x0002
# define PropertyTagGpsLongitudeRef 0 x0003
# define PropertyTagGpsLongitude 0 x0004
# define PropertyTagGpsAltitudeRef 0 x0005
# define PropertyTagGpsAltitude 0 x0006
# define PropertyTagGpsGpsTime 0 x0007
# define PropertyTagGpsGpsSatellites 0 x0008
# define PropertyTagGpsGpsStatus 0 x0009
# define PropertyTagGpsGpsMeasureMode 0 x00a
# define PropertyTagGpsGpsDop 0 x000b//Measurement precision
# define PropertyTagGpsSpeedRef 0 x000c
# define PropertyTagGpsSpeed 0 x000d
# define PropertyTagGpsTrackRef 0 x000e
# define PropertyTagGpsTrack 0 x000f
# define PropertyTagGpsImgDirRef 0 x0010
# define PropertyTagGpsImgDir 0 x0011
# define PropertyTagGpsMapDatum 0 x0012
# define PropertyTagGpsDestLatRef 0 x0013
# define PropertyTagGpsDestLat 0 x0014
# define PropertyTagGpsDestLongRef 0 x0015
# define PropertyTagGpsDestLong 0 x0016
# define PropertyTagGpsDestBearRef 0 x0017
# define PropertyTagGpsDestBear 0 x0018
# define PropertyTagGpsDestDistRef 0 x0019
# define PropertyTagGpsDestDist 0 x001a
# define PropertyTagGpsProcessingMethod 0 x001b
# define PropertyTagGpsAreaInformation 0 x001c
# define PropertyTagGpsDate 0 x001d
# define PropertyTagGpsDifferential 0 x001e


Finally attach PropertyItem definition and attribute definition of data types:
 
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
//Property Item
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The class PropertyItem
{
Public:
PROPID id;//ID of this property
ULONG length;//the Length of the property value, in bytes
The WORD type;//the Type of the value, as one of TAG_TYPE_XXX
//defined above
VOID * value;//the property value
};

//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
//Image property types
//-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
# define PropertyTagTypeByte 1
# define PropertyTagTypeASCII 2
# define PropertyTagTypeShort 3
# define PropertyTagTypeLong 4
# define PropertyTagTypeRational 5
# define PropertyTagTypeUndefined 7
9 # define PropertyTagTypeSLONG
# define PropertyTagTypeSRational 10

CodePudding user response:

reference 3 floor cluttered elder brother reply:
this problem I really know, because I studied before the direction of the image information,

In general, some devices will take pictures with "direction, equipment, time, location, location" and so on information, the information referred to as EXIF information, specific to baidu, then recommend an online photo EXIF information website, for example, I posted a iPhone6 picture taken, can resolve the contains a large amount of additional information, including the original poster wants to know the GPS information, as shown in figure:



On the following code, using MFC GDI + relevant graphics interface:
 
The Image * pImg=Image: : FromFile (_T (" F: \ \ multimedia material \ \ Photos \ \ IMG_0166 JPG "), FALSE);
If (pImg) {
PropertyItem * PropertyItem=NULL;
UINT size=pImg - & gt; nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related