Last active
September 29, 2017 12:37
-
-
Save olokobayusuf/2906b6c4070e3a7975559998919ee54e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Barcode detection built upon ZXing.NET 0.14.0.0 | |
#define ZXING_API | |
#if ZXING_API | |
using ZXing; | |
#endif | |
private static BarcodeReader reader {...} | |
public static void DetectBarcode (Color32[] frame, int width, int height, MetadataCallback<IMetadata> callback) { | |
if (frame == null || callback == null) return; | |
#if ZXING_API | |
reader.DecodeMultiple(frame, width, height).ForEach(result => callback(NatCamBarcode(result))); | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there. I just saw this comment. In NatCam 1.5, you can use the System.Runtime.InteropServices.Marshal API's to copy native data into a
Color32[]
. You pin the array withGCHandle
, get its pointer, and useMarshal.Copy
. In NatCam 1.6, we added aPreviewBuffer
overload that takes in aColor32[]
.