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

Error: CalcHist - object has no property: ranges #865

Open
black-posterus opened this issue Mar 1, 2023 · 1 comment
Open

Error: CalcHist - object has no property: ranges #865

black-posterus opened this issue Mar 1, 2023 · 1 comment

Comments

@black-posterus
Copy link

black-posterus commented Mar 1, 2023

使用官方进行读取图片并进行直方图计算
代码如下

  const img = cv.imread(imgPath, cv.IMREAD_GRAYSCALE);
  const histSize = [256];
  const channels = [0];
  const ranges = [0, 256];
  console.log('img',img)
  const hist = cv.calcHist(img, channels, new cv.Mat([256], [1], cv.CV_32F), histSize, ranges);
  return hist;

打印的图片数据如下

img Mat {
  step: 375,
  elemSize: 1,
  sizes: [ 3243, 375 ],
  empty: false,
  depth: 0,
  dims: 2,
  channels: 1,
  type: 0,
  cols: 375,
  rows: 3243 }

报错Error: CalcHist - object has no property: ranges
at Error (native)
at calcHistogram (/app/histogram_opencv.js:30:19)
at calcImageSimilarity (/app/histogram_opencv.js:35:17)
at processImages (/app/histogram_opencv.js:60:28)
at Object. (/app/histogram_opencv.js:70:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

@luoxihui
Copy link

你好,方便给我一份编译之后的opencv4nodejs么,我本机怎么都安装不上,试了网上各种办法,放弃了,想着直接拷贝到项目内部引用

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