How to crop an image by detecting the edge in flutter - flutter

I am trying to crop the image by detecting the image edge in flutter. But i am not getting how to do that. I have also tried the package edge_detection but its not working well for the documents. Is there is another method to detect the edge properly and crop that image.

Aside from edge_detection there is no official library published by pub_dev that contains cropping with edge detection.
However, you should check out this link which contains the essentials for the implementation in your project.

Related

How to get image rotate angle value from flutter_image_cropper plugin

We have referred to the below GitHub code-
https://github.com/JakobStadlhuber/flutter_image_cropper
if you have any idea how I could retrieve the rotate and crop values for the original image, that would be great.
alternatively, if you know of any other plug-in where I would be able to crop/rotate/edit the image that would be greatly appreciated.
I am building the app in a flutter.

Face Detection in Preview Camera Feed on Flutter

How do we "draw a square" on detected faces on camera preview feed in Flutter? Is there a cross platform solution to this?
Flutter provides a Camera Plugin, but is there a way for us to draw a square box detecting faces on the preview feed? Any thoughts on this please?
.
SOMETHING LIKE THIS EXAMPLE CAMERA PREVIEW FEED
Firstly, get the image data. This can be done by either using the camera plugin's output, or even directly communicate with the SurfaceView/TextureView.
Secondly, run face detection algorithm. If you do not need cross-platform, https://medium.flutterdevs.com/face-detection-in-flutter-2af14455b90d?gi=f5ead7c6d7c9 MLKit sounds good. If needing cross-platform, you can use Rust algorithms like https://github.com/atomashpolskiy/rustface and bind Rust code to Flutter via https://github.com/fzyzcjy/flutter_rust_bridge. Or, use C++ face detection algorithms and bind to Flutter (though setup may be a bit harder).
Lastly, once you know the face, draw a box around it. For example, Container widget.

I have attached a image. I am trying to get such effect on flutter. Can anyone tell how such effects are created?

I am doing Flutter development. I want to add image like this and want to know how such effects or images are created. I think 3D effect is used. But I don't know how to create such image. Please help.
[![Attached Image][1]]
[1]: https://i.stack.imgur.com/TNiUZ.png
You can either directly create this kind of image using your picture editor (PS, Figma, Paint, anything really). Add manually a margin to your Card and set the Runner for it to be out of the Card. Then simply display the picture file in Flutter using Image.assets(...).
In the case you want to programmatically create a similar image you can use a Stack in Flutter in order to make the runner picture overflow the card positioning manually both pictures.

Rectangular box to scan/analyze on the camera preview with Flutter Google-ml-kit Text Recognition

There's an example app using on-device Text Recognition of Google ML Kit: https://github.com/bharat-biradar/Google-Ml-Kit-plugin/tree/master/example
I'm using the "text recognition" part of that example app in my app and it works good. The only thing I need to do but can't do is that I want to show a rectangular box on the camera preview and only want to recognize texts inside this box. Other parts of the preview should be ignored. Otherwise, all the text in the preview would be recognized which is bad for my use case.
It's easy to show a rectangular box on the camera preview but I don't know how to only analyze the part in that rectangular box instead of the whole preview. Any help please?
There are two ideas you can consider:
(1) Crop your camera preview down to only the rectangular box and feed that cropped image to the ML Kit API.
(2) ML Kit's Text Recognition API returns a bounding box on Android (and frame on iOS). You can use that to determine if any of the text recognition results falls into or overlaps with your rectangular box. Depending on your use case and the input image, this approach may not be ideal since it can return text recognition result for text not entirely inside your rectangle.

Edge detection and removal on iOS using opencv

i have a project similar to what iphone scanner apps do (docscanner, scannerpro, etc).
but i'm new to opencv and objective-c. the app is supposed to detect and remove the edges/background of a document/paper taken a photo of using an iphone.
i've seen this DETECT the Edge of a Document in iPhoneSDK which is what i want to do. i've seen what canny does but all it shows are edges of all shapes in the image, not the paper i want to separate.
i think this is what i'm supposed to do: OpenCV C++/Obj-C: Detecting a sheet of paper / Square Detection but i can't make it work in xcode.
and i don't know how to do it (being a newbie). i've looked hard everywhere and couldn't find a way to detect edges of a document and crop them from the image. or maybe i found something but i didn't understand. i'm supposed to code it in xcode and objective-c.