card.io-dmz icon indicating copy to clipboard operation
card.io-dmz copied to clipboard

Compiling in Windows

Open mingledj2 opened this issue 10 years ago • 8 comments
trafficstars

I've spent a few days trying to get this to compile in Windows. I figured I would ask if anyone has had any success compiling this for use in a Windows Desktop application?

mingledj2 avatar Aug 31 '15 17:08 mingledj2

I don't know of anyone, but I would be interested to hear of people's experiences.

What are the build failures you are experiencing? I don't have any windows experience, but maybe I could provide some hints or guesses.

josharian avatar Aug 31 '15 18:08 josharian

There have been a few things (such as likely/unlikely) that I've had to work around due to them not existing in Windows. Currently I'm dealing with about 30 linker errors that seem to stem from opencv. I've been working towards trying to figure out those issues.

mingledj2 avatar Aug 31 '15 19:08 mingledj2

Cool. Feel free to ask for help (with details) if you so desire.

josharian avatar Aug 31 '15 21:08 josharian

Update: I have it compiling in Windows. Still running across some issues actually getting a card to scan. I grabbed one of the sample images and have had issues getting it to work. Perhaps you guys can help, my code is as follows (modeled after some of the JNI code from the Android Card.IO source):

int main(int argc, char** argv) { dmz_context* context = dmz_context_create(); scanner_initialize(&scannerState);

int ret = dmz_has_opencv(); if (ret == 1) { IplImage* iplImage = cvLoadImage(argv[1], 1);

  IplImage *image = cvCreateImageHeader(cvSize(iplImage->width, iplImage->height), IPL_DEPTH_8U, 1);
  image->imageData = iplImage->imageData;

  IplImage *cbcr = cvCreateImageHeader(cvSize(iplImage->width / 2, iplImage->height / 2), IPL_DEPTH_8U, 2);
  cbcr->imageData = iplImage->imageData + iplImage->width * iplImage->height;

  IplImage *cb, *cr;
  dmz_deinterleave_uint8_c2(cbcr, &cb, &cr);
  cvReleaseImageHeader(&cbcr);

  dmz_edges found_edges;
  dmz_corner_points corner_points;
  bool cardDetected = dmz_detect_edges(image, cb, cr, FrameOrientationPortrait, &found_edges, &corner_points);

  if (cardDetected)
  {
     IplImage *cardY = NULL;
     dmz_transform_card(NULL, image, corner_points, FrameOrientationLandscapeRight, false, &cardY);

     FrameScanResult result;
     scanner_add_frame(&scannerState, cardY, &result);

     if (result.usable)
     {
        ScannerResult scanResult;
        scanner_result(&scannerState, &scanResult);
     }
  }

}

In this case, cardDetected is always false regardless of the FrameOrientation (I've tried them all).

Thanks for any advice in advance.

mingledj2 avatar Sep 02 '15 19:09 mingledj2

card.io requires a stream of images of the same card. This provides extra confidence (see https://www.youtube.com/watch?v=T9TkkZg1L7s). As a short term hack experiment, try providing the same image frame repeatedly. Note that not all frames will work; you might have to try several to find a readable one (which is part of the reason we require a stream of images).

josharian avatar Sep 02 '15 21:09 josharian

I'm actually sending it frames from a live stream now. None of them ever come back as usable though. I'm looking through some of the JNI/Java Wrapper to see if there's any special processing that needs to be done.

mingledj2 avatar Sep 08 '15 13:09 mingledj2

mingledj2,

I've been tasked with doing the same. Would you mind sharing some of the details of your experience getting it compiling? What toolset did you use? Code changes necessary?

ryanburdettkofax avatar Oct 07 '15 16:10 ryanburdettkofax

Hi Everyone

I would like ask the same question if there is any possibility to build cardio on windows

Best Regards

moneer88 avatar Oct 29 '18 18:10 moneer88