Closed eloops closed 9 years ago
I seem to have fixed this issue, I'm not entirely sure how I've managed to though. I tried to run npm install --arch=ia32 --msvs_version=2013
(from the installation instructions for sharp/Windows) and node-gyp recompiled dv.
I had also used bluebird to promisify fs
, although I wasn't using it.
I can't really point to either of these as solid 'fixes' (after re-compiling I saw the error at least a few more times).
Here's what my code looks like now:
sharp(fs.readFileSync(fpath)).png().toBuffer(function(err, data, info) {
if (err) {
throw err
} else {
var image = new dv.Image('png', data)
var tesseract = new dv.Tesseract('eng', image)
tesseract.pageSegMode = 'auto_only'
var word_bbox = tesseract.findWords()
var para_bbox = tesseract.findParagraphs()
}
})
The only change that I can see is using the new
word to force the constructor.
Yes, you must initialize a dv.Image
with new
, otherwise you will get the "Assertion failed!" error message. Also see #22.
We are aware, that this is an issue, especially for new dv users.
I'm trying to pass a TIFF file through sharp, outputting to a buffer and then creating a new Image with the output.
node 0.12.7 x86, on Windows 8.1 64-bit. DV compiled with vs2013 (through node-gyp install dv)
When I do a conversion to PNG and pass it through as a buffer:
This results in this error popping up on screen:
Similarly, if I instead convert it to a raw and pass it through along with the width/height:
It errors with:
I feel like I'm missing something here?