Q
優化相機QR碼
2
A
回答
1
大多數的這些設置最佳值會根據使用環境(如暗/明亮的房間裏,遠/近QR碼等),所以,除非你知道你的用戶的環境(例如,如果應用程序是專門用於在工廠組裝線),默認值可能是最好的。
但是(根據this source),如果您知道QR碼將靠近相機,您可以通過將autoFocusRangeRestriction設置爲近距離值來加速自動對焦。您還可以確保smoothAutoFocusEnabled設置爲false。
-4
我使用AVCaptureDevice。 這段代碼工作發現我在我的條形碼app.try中使用了這個代碼。
-(void)BarcodeStart
{
_highlightView = [[UIView alloc] init];
_highlightView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleBottomMargin;
_highlightView.layer.borderColor = [UIColor lightGrayColor].CGColor;
_highlightView.layer.borderWidth = 3;
[barcameraView addSubview:_highlightView];
_label = [[UILabel alloc] init];
_label.frame = CGRectMake(0, self.view.bounds.size.height - 40, self.view.bounds.size.width, 40);
_label.autoresizingMask = UIViewAutoresizingFlexibleTopMargin;
_label.backgroundColor = [UIColor colorWithWhite:0.15 alpha:0.65];
_label.textColor = [UIColor whiteColor];
_label.textAlignment = NSTextAlignmentCenter;
_label.text = @"(none)";
[self.view addSubview:_label];
//BackBtn UP side Show
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
//[button addTarget:self action:@selector(aMethod:)forControlEvents:UIControlEventTouchDown];
UIImageView *img = [[UIImageView alloc] init];
button.frame = CGRectMake(3,19,30,30);
img.image = [UIImage imageNamed:@"backBtnImg.png"];
[button setImage:img.image forState:UIControlStateNormal];
[_highlightView addSubview:button];
//
_session = [[AVCaptureSession alloc] init];
_device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
NSError *error = nil;
_input = [AVCaptureDeviceInput deviceInputWithDevice:_device error:&error];
if (_input) {
[_session addInput:_input];
} else {
NSLog(@"Error: %@", error);
}
_output = [[AVCaptureMetadataOutput alloc] init];
[_output setMetadataObjectsDelegate:self queue:dispatch_get_main_queue()];
[_session addOutput:_output];
_output.metadataObjectTypes = [_output availableMetadataObjectTypes];
_prevLayer = [AVCaptureVideoPreviewLayer layerWithSession:_session];
// _prevLayer.frame = CGRectMake(20, 70, 280, 280);
_prevLayer.frame = barcameraView.bounds;
_prevLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
[barcameraView.layer addSublayer:_prevLayer];
[_session startRunning];
[barcameraView bringSubviewToFront:_highlightView];
[self.view bringSubviewToFront:_label];
}
+0
我在這裏看不到任何手動相機設置。 – Randomblue
+0
好的感謝您的建議... – 1994
相關問題
- 1. zxing.net QR解碼優化
- 2. 在java中不使用相機的QR碼解碼
- 3. 無需使用相機即可解碼QR碼圖像
- 4. QR的QR碼在
- 5. 移動照相機可以讀取QR碼嗎?
- 6. 打開相機在屏幕中間的Android QR代碼
- 7. 如何更改Android QR碼掃描儀中的相機屏幕?
- 8. 我如何使用android相機掃描QR碼?
- 9. 用於打開相機並掃描QR碼的Android API?
- 10. 如何用qr碼掃描儀打開相機?
- 11. QR代碼掃描沒有全屏相機
- 12. ZXing直接從相機掃描QR碼圖片
- 13. ActiveAndroid優化相表
- 14. 優化代碼
- 15. 代碼優化
- 16. 虛擬機優化
- 17. 解碼QR碼
- 18. QR代碼 - 攝像機方向/投影
- 19. 德爾福QR碼組件/發電機?
- 20. 如何在手機上顯示QR碼
- 21. 如何格式化QR碼輸出?
- 22. 優化Android代碼
- 23. 優化代碼jsf
- 24. 優化Haskell代碼
- 25. VBA代碼優化
- 26. Neo4j密碼優化
- 27. PHP代碼優化
- 28. 優化C++代碼
- 29. 優化VHDL代碼
- 30. 優化此代碼?
這是完美的,謝謝! – Randomblue