Merge pull request #228 from bletchley/feature/barcode-screen-coordinates
transform barcode metadata points to screen coordinates
This commit is contained in:
commit
067a37146c
|
@ -712,18 +712,20 @@ didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL
|
|||
for (AVMetadataMachineReadableCodeObject *metadata in metadataObjects) {
|
||||
for (id barcodeType in [self getBarCodeTypes]) {
|
||||
if (metadata.type == barcodeType) {
|
||||
// Transform the meta-data coordinates to screen coords
|
||||
AVMetadataMachineReadableCodeObject *transformed = (AVMetadataMachineReadableCodeObject *)[_previewLayer transformedMetadataObjectForMetadataObject:metadata];
|
||||
|
||||
NSDictionary *event = @{
|
||||
@"type": metadata.type,
|
||||
@"data": metadata.stringValue,
|
||||
@"bounds": @{
|
||||
@"origin": @{
|
||||
@"x": [NSString stringWithFormat:@"%f", metadata.bounds.origin.x],
|
||||
@"y": [NSString stringWithFormat:@"%f", metadata.bounds.origin.y]
|
||||
@"x": [NSString stringWithFormat:@"%f", transformed.bounds.origin.x],
|
||||
@"y": [NSString stringWithFormat:@"%f", transformed.bounds.origin.y]
|
||||
},
|
||||
@"size": @{
|
||||
@"height": [NSString stringWithFormat:@"%f", metadata.bounds.size.height],
|
||||
@"width": [NSString stringWithFormat:@"%f", metadata.bounds.size.width],
|
||||
@"height": [NSString stringWithFormat:@"%f", transformed.bounds.size.height],
|
||||
@"width": [NSString stringWithFormat:@"%f", transformed.bounds.size.width],
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue