很多航测朋友对于照片中没有POS点很是懊恼,单反同飞控是分离的,照片由单反生成,而POS点的数据由飞控生成。对于后期数据处理相当不利,尤其是目前对于倾斜摄影的朋友,地理位置信息一定要写到照片中去,而动辄几百上千的照片通过手工加入地理位置信息,是非常不现实的。所以我编写了一个程序,可以通过这个程序将飞控生成得POS点数据批量加入单反所拍摄的照片中。
下面以纵横的飞控生成的POS数据为列子:
数据是以.txt文本的形式进行保存的。
我们需要的数据是 第三列的经度,第四列的纬度,第五列的高度信息。
当然,我的程序需要POS点信息排序同照片的名字排序是都是増序,即POS信息第一条数据是DSC_0001,假设单反拍摄的第一张照片DSC_0078.JPG,那么这就要求DSC_0002数据对应的照片名字为DSC_0079.JPG,以此类推。
那么怎么批量为照片添加POS数据呢?
首先,我们得为一张照片添加POS点,然后才能为大量照片添加,首先我来介绍一下我们的主角exiv2
大部分exif的库都不是很好用,exiv2 (http://www.exiv2.org) 挺不错。但在windows下编译很烦。
我们可以通过命令
exiv2 -M"set Exif.GPSInfo.GPSLatitude 4/1 15/1 33/1" -M"set Exif.GPSInfo.GPSLatitudeRef N" image.jpg
这个命令就是为照片添加一个卑微4°15′33″的GPS信息
当我们要批量为照片添加GPS信息时,我们可以通过读入飞控生成的GPS信息然后循环使用3条命令将这些信息写入照片中:1.添加经度信息,2.添加纬度信息,3.添加高度信息。
cmd_Latitude =" -M\"set Exif.GPSInfo.GPSLatitude"+latitude_value+"\""+"-M \"setExif.GPSInfo.GPSLatitudeRefN\" ";
cmd_Longitude =" -M \"set Exif.GPSInfo.GPSLongitude "+Longitude_value+"\""+" -M \"set Exif.GPSInfo.GPSLongitudeRef E\" ";
cmd_GPSAltitude=" -M \"set Exif.GPSInfo.GPSAltitude "+Altitude_value+"\" ";
qDebug((cmd_Latitude+cmd_Longitude+cmd_GPSAltitude+fileName).toLatin1().data());
p.start("exiv2.exe"+cmd_Latitude+cmd_Longitude+cmd_GPSAltitude+fileName);
p.waitForStarted();
p.waitForFinished();
qDebug()<<QString::fromLocal8Bit(p.readAllStandardError());
以上就是程序的主要代码实现,代码是使用Qt编写的,上面是通过Qt调用exiv2来执行命令来将信息写入。
执行程序之后可以为照片添加GPS信息
exiv2还同样支持以下命令:
Exif.Image.ProcessingSoftware
Exif.Image.NewSubfileType
Exif.Image.SubfileType
Exif.Image.ImageWidth
Exif.Image.ImageLength
Exif.Image.BitsPerSample
Exif.Image.Compression
Exif.Image.PhotometricInterpretation
Exif.Image.Thresholding
Exif.Image.CellWidth
Exif.Image.CellLength
Exif.Image.FillOrder
Exif.Image.DocumentName
Exif.Image.ImageDescription
Exif.Image.Make
Exif.Image.Model
Exif.Image.StripOffsets
Exif.Image.Orientation
Exif.Image.SamplesPerPixel
Exif.Image.RowsPerStrip
Exif.Image.StripByteCounts
Exif.Image.XResolution
Exif.Image.YResolution
Exif.Image.PlanarConfiguration
Exif.Image.GrayResponseUnit
Exif.Image.GrayResponseCurve
Exif.Image.T4Options
Exif.Image.T6Options
Exif.Image.ResolutionUnit
Exif.Image.PageNumber
Exif.Image.TransferFunction
Exif.Image.Software
Exif.Image.DateTime
Exif.Image.Artist
Exif.Image.HostComputer
Exif.Image.Predictor
Exif.Image.WhitePoint
Exif.Image.PrimaryChromaticities
Exif.Image.ColorMap
Exif.Image.HalftoneHints
Exif.Image.TileWidth
Exif.Image.TileLength
Exif.Image.TileOffsets
Exif.Image.TileByteCounts
Exif.Image.SubIFDs
Exif.Image.InkSet
Exif.Image.InkNames
Exif.Image.NumberOfInks
Exif.Image.DotRange
Exif.Image.TargetPrinter
Exif.Image.ExtraSamples
Exif.Image.SampleFormat
Exif.Image.SMinSampleValue
Exif.Image.SMaxSampleValue
Exif.Image.TransferRange
Exif.Image.ClipPath
Exif.Image.XClipPathUnits
Exif.Image.YClipPathUnits
Exif.Image.Indexed
Exif.Image.JPEGTables
Exif.Image.OPIProxy
Exif.Image.JPEGProc
Exif.Image.JPEGInterchangeFormat
Exif.Image.JPEGInterchangeFormatLength
Exif.Image.JPEGRestartInterval
Exif.Image.JPEGLosslessPredictors
Exif.Image.JPEGPointTransforms
Exif.Image.JPEGQTables
Exif.Image.JPEGDCTables
Exif.Image.JPEGACTables
Exif.Image.YCbCrCoefficients
Exif.Image.YCbCrSubSampling
Exif.Image.YCbCrPositioning
Exif.Image.ReferenceBlackWhite
Exif.Image.XMLPacket
Exif.Image.Rating
Exif.Image.RatingPercent
Exif.Image.ImageID
Exif.Image.CFARepeatPatternDim
Exif.Image.CFAPattern
Exif.Image.BatteryLevel
Exif.Image.Copyright
Exif.Image.ExposureTime
Exif.Image.FNumber
Exif.Image.IPTCNAA
Exif.Image.ImageResources
Exif.Image.ExifTag
Exif.Image.InterColorProfile
Exif.Image.ExposureProgram
Exif.Image.SpectralSensitivity
Exif.Image.GPSTag
Exif.Image.ISOSpeedRatings
Exif.Image.OECF
Exif.Image.Interlace
Exif.Image.TimeZoneOffset
Exif.Image.SelfTimerMode
Exif.Image.DateTimeOriginal
Exif.Image.CompressedBitsPerPixel
Exif.Image.ShutterSpeedValue
Exif.Image.ApertureValue
Exif.Image.BrightnessValue
Exif.Image.ExposureBiasValue
Exif.Image.MaxApertureValue
Exif.Image.SubjectDistance
Exif.Image.MeteringMode
Exif.Image.LightSource
Exif.Image.Flash
Exif.Image.FocalLength
Exif.Image.FlashEnergy
Exif.Image.SpatialFrequencyResponse
Exif.Image.Noise
Exif.Image.FocalPlaneXResolution
Exif.Image.FocalPlaneYResolution
Exif.Image.FocalPlaneResolutionUnit
Exif.Image.ImageNumber
Exif.Image.SecurityClassification
Exif.Image.ImageHistory
Exif.Image.SubjectLocation
Exif.Image.ExposureIndex
Exif.Image.TIFFEPStandardID
Exif.Image.SensingMethod
Exif.Image.XPTitle
Exif.Image.XPComment
Exif.Image.XPAuthor
Exif.Image.XPKeywords
Exif.Image.XPSubject
Exif.Image.PrintImageMatching
Exif.Image.DNGVersion
Exif.Image.DNGBackwardVersion
Exif.Image.UniqueCameraModel
Exif.Image.LocalizedCameraModel
Exif.Image.CFAPlaneColor
Exif.Image.CFALayout
Exif.Image.LinearizationTable
Exif.Image.BlackLevelRepeatDim
Exif.Image.BlackLevel
Exif.Image.BlackLevelDeltaH
Exif.Image.BlackLevelDeltaV
Exif.Image.WhiteLevel
Exif.Image.DefaultScale
Exif.Image.DefaultCropOrigin
Exif.Image.DefaultCropSize
Exif.Image.ColorMatrix1
Exif.Image.ColorMatrix2
Exif.Image.CameraCalibration1
Exif.Image.CameraCalibration2
Exif.Image.ReductionMatrix1
Exif.Image.ReductionMatrix2
Exif.Image.AnalogBalance
Exif.Image.AsShotNeutral
Exif.Image.AsShotWhiteXY
Exif.Image.BaselineExposure
Exif.Image.BaselineNoise
Exif.Image.BaselineSharpness
Exif.Image.BayerGreenSplit
Exif.Image.LinearResponseLimit
Exif.Image.CameraSerialNumber
Exif.Image.LensInfo
Exif.Image.ChromaBlurRadius
Exif.Image.AntiAliasStrength
Exif.Image.ShadowScale
Exif.Image.DNGPrivateData
Exif.Image.MakerNoteSafety
Exif.Image.CalibrationIlluminant1
Exif.Image.CalibrationIlluminant2
Exif.Image.BestQualityScale
Exif.Image.RawDataUniqueID
Exif.Image.OriginalRawFileName
Exif.Image.OriginalRawFileData
Exif.Image.ActiveArea
Exif.Image.MaskedAreas
Exif.Image.AsShotICCProfile
Exif.Image.AsShotPreProfileMatrix
Exif.Image.CurrentICCProfile
Exif.Image.CurrentPreProfileMatrix
Exif.Image.ColorimetricReference
Exif.Image.CameraCalibrationSignature
Exif.Image.ProfileCalibrationSignature
Exif.Image.AsShotProfileName
Exif.Image.NoiseReductionApplied
Exif.Image.ProfileName
Exif.Image.ProfileHueSatMapDims
Exif.Image.ProfileHueSatMapData1
Exif.Image.ProfileHueSatMapData2
Exif.Image.ProfileToneCurve
Exif.Image.ProfileEmbedPolicy
Exif.Image.ProfileCopyright
Exif.Image.ForwardMatrix1
Exif.Image.ForwardMatrix2
Exif.Image.PreviewApplicationName
Exif.Image.PreviewApplicationVersion
Exif.Image.PreviewSettingsName
Exif.Image.PreviewSettingsDigest
Exif.Image.PreviewColorSpace
Exif.Image.PreviewDateTime
Exif.Image.RawImageDigest
Exif.Image.OriginalRawFileDigest
Exif.Image.SubTileBlockSize
Exif.Image.RowInterleaveFactor
Exif.Image.ProfileLookTableDims
Exif.Image.ProfileLookTableData
Exif.Image.OpcodeList1
Exif.Image.OpcodeList2
Exif.Image.OpcodeList3
Exif.Image.NoiseProfile
Exif.Photo.ExposureTime
Exif.Photo.FNumber
Exif.Photo.ExposureProgram
Exif.Photo.SpectralSensitivity
Exif.Photo.ISOSpeedRatings
Exif.Photo.OECF
Exif.Photo.SensitivityType
Exif.Photo.StandardOutputSensitivity
Exif.Photo.RecommendedExposureIndex
Exif.Photo.ISOSpeed
Exif.Photo.ISOSpeedLatitudeyyy
Exif.Photo.ISOSpeedLatitudezzz
Exif.Photo.ExifVersion
Exif.Photo.DateTimeOriginal
Exif.Photo.DateTimeDigitized
Exif.Photo.ComponentsConfiguration
Exif.Photo.CompressedBitsPerPixel
Exif.Photo.ShutterSpeedValue
Exif.Photo.ApertureValue
Exif.Photo.BrightnessValue
Exif.Photo.ExposureBiasValue
Exif.Photo.MaxApertureValue
Exif.Photo.SubjectDistance
Exif.Photo.MeteringMode
Exif.Photo.LightSource
Exif.Photo.Flash
Exif.Photo.FocalLength
Exif.Photo.SubjectArea
Exif.Photo.MakerNote
Exif.Photo.UserComment
Exif.Photo.SubSecTime
Exif.Photo.SubSecTimeOriginal
Exif.Photo.SubSecTimeDigitized
Exif.Photo.FlashpixVersion
Exif.Photo.ColorSpace
Exif.Photo.PixelXDimension
Exif.Photo.PixelYDimension
Exif.Photo.RelatedSoundFile
Exif.Photo.InteroperabilityTag
Exif.Photo.FlashEnergy
Exif.Photo.SpatialFrequencyResponse
Exif.Photo.FocalPlaneXResolution
Exif.Photo.FocalPlaneYResolution
Exif.Photo.FocalPlaneResolutionUnit
Exif.Photo.SubjectLocation
Exif.Photo.ExposureIndex
Exif.Photo.SensingMethod
Exif.Photo.FileSource
Exif.Photo.SceneType
Exif.Photo.CFAPattern
Exif.Photo.CustomRendered
Exif.Photo.ExposureMode
Exif.Photo.WhiteBalance
Exif.Photo.DigitalZoomRatio
Exif.Photo.FocalLengthIn35mmFilm
Exif.Photo.SceneCaptureType
Exif.Photo.GainControl
Exif.Photo.Contrast
Exif.Photo.Saturation
Exif.Photo.Sharpness
Exif.Photo.DeviceSettingDescription
Exif.Photo.SubjectDistanceRange
Exif.Photo.ImageUniqueID
Exif.Photo.CameraOwnerName
Exif.Photo.BodySerialNumber
Exif.Photo.LensSpecification
Exif.Photo.LensMake
Exif.Photo.LensModel
Exif.Photo.LensSerialNumber
Exif.Iop.InteroperabilityIndex
Exif.Iop.InteroperabilityVersion
Exif.Iop.RelatedImageFileFormat
Exif.Iop.RelatedImageWidth
Exif.Iop.RelatedImageLength
Exif.GPSInfo.GPSVersionID
Exif.GPSInfo.GPSLatitudeRef
Exif.GPSInfo.GPSLatitude
Exif.GPSInfo.GPSLongitudeRef
Exif.GPSInfo.GPSLongitude
Exif.GPSInfo.GPSAltitudeRef
Exif.GPSInfo.GPSAltitude
Exif.GPSInfo.GPSTimeStamp
Exif.GPSInfo.GPSSatellites
Exif.GPSInfo.GPSStatus
Exif.GPSInfo.GPSMeasureMode
Exif.GPSInfo.GPSDOP
Exif.GPSInfo.GPSSpeedRef
Exif.GPSInfo.GPSSpeed
Exif.GPSInfo.GPSTrackRef
Exif.GPSInfo.GPSTrack
Exif.GPSInfo.GPSImgDirectionRef
Exif.GPSInfo.GPSImgDirection
Exif.GPSInfo.GPSMapDatum
Exif.GPSInfo.GPSDestLatitudeRef
Exif.GPSInfo.GPSDestLatitude
Exif.GPSInfo.GPSDestLongitudeRef
Exif.GPSInfo.GPSDestLongitude
Exif.GPSInfo.GPSDestBearingRef
Exif.GPSInfo.GPSDestBearing
Exif.GPSInfo.GPSDestDistanceRef
Exif.GPSInfo.GPSDestDistance
Exif.GPSInfo.GPSProcessingMethod
Exif.GPSInfo.GPSAreaInformation
Exif.GPSInfo.GPSDateStamp
Exif.GPSInfo.GPSDifferential
为照片添加更多的EXIF信息。
因为不同飞控生成的数据可能不同,所以并没有将纵横的POS数据处理代码贴出了,对其他飞控POS数据有处理要求或者需要为照片添加其他EXIF数据的朋友可以发送邮件联系我邮箱:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)