Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

ImageUtil.toFile always return null #60

Closed
JohnZcp opened this issue May 17, 2022 · 2 comments
Closed

ImageUtil.toFile always return null #60

JohnZcp opened this issue May 17, 2022 · 2 comments

Comments

@JohnZcp
Copy link

JohnZcp commented May 17, 2022

Version

0.0.0-04292022-1206-56d9e1d56

Problem Area

react-native-pytorch-core (core package)

Steps to Reproduce

I am trying to save the image to the file and save in the photo library, but the result from ImageUtil.toFile is null. Here is the output from the ImageUtil.toFile:{"_U": 0, "_V": 0, "_W": null, "_X": null}.

Expected Results

No response

Code example, screenshot, or link to repository

const handleImage = async(image) =>{
try{
if(distanceTravelled >= 1 && isStart){
const results = await detectObjects(model, image);
let frame = [];
console.log("Frame " + count + ":");
for(let i=0;i<results.length;i++){
const result = results[i];
const left = Math.round(result.bounding_box[0]/2.5);
const top = Math.round(result.bounding_box[1]/2.5);
const right = Math.round(result.bounding_box[2]/2.5);
const bottom = Math.round(result.bounding_box[3]/2.5);
console.log(left+"----"+top+"----"+right+"----"+bottom);
const boundingbox = [left, top, right, bottom];
frame.push(boundingbox);
}
boundingbox_array.push(frame);
let path = ImageUtil.toFile(image);
console.log(path);
frame_array.push(path._W);
count+=1;
SetDistanceTravelled(0.0);
}
image.release();
}catch(e){
console.log(e);
}

};
@Gernii
Copy link

Gernii commented May 17, 2022

@JohnZcp this is an async function, it'll return Promise, so u have to await that function. Btw, you need to read the document more carefully.

image

@clarksandholtz
Copy link
Contributor

Seems this is resolved. Closing.

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

No branches or pull requests

3 participants