Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different path co-ordinates #2

Open
MRK196 opened this issue Nov 23, 2017 · 1 comment
Open

Different path co-ordinates #2

MRK196 opened this issue Nov 23, 2017 · 1 comment

Comments

@MRK196
Copy link

MRK196 commented Nov 23, 2017

Hi @olivierlando, I have installed this excellent package for my test application, however when I am testing the code functionality with the example you proved (and with the same image) I am getting different co-ordinates from the ones you are expecting to get.

Instead of these co-ordinates [62, 413], [63, 406], [69, 390], I am getting:

[63, 294], [69, 288], [95, 292], [121, 304]...

I am using the exact same test code you provided:

 `const fs = require('fs');
 const jpeg = require('jpeg-js');
 const PathFromImage = require('path-from-image');

  const bluePointCoords = [62, 413];
 const redPointCoords = [514, 39];

 const image = jpeg.decode(fs.readFileSync('road.jpg'), true);
 const pathFromImage = new PathFromImage({
   width: image.width,
   height: image.height,
   imageData: image.data,
   colorPatterns: [{ r: [60, 255], g: [0, 70], b: [60, 255] }], // description of the mauve / ping color
 });
 const path = pathFromImage.path(bluePointCoords, redPointCoords); 

Any reason for such a discrepancy? Thanks

@RyanRizzo96
Copy link

Hi, I believe it has something to do with this line: colorPatterns: [{ r: [60, 255], g: [0, 70], b: [60, 255] }],.

I am struggling to understand how this works exactly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants