Android Developers
1.2K subscribers
164 photos
3 videos
57 files
58 links
Here You Can Get Android App Development Tutorials For Free

LinkTree
https://linktr.ee/androiddeveloperspage

For Comments & Feedback
@androiddevstutorialscommentbot

Contact Me
@SE_BIBEL_MEK
Download Telegram
👍1
💯2👍1
OpenCV

OpenCV (Open Source Computer Vision Library) is an open-source computer vision and machine learning software library. It contains a comprehensive set of tools and functions for real-time image processing, computer vision tasks, and machine learning applications. Here are some key features of OpenCV:

1. Image Processing: It provides a wide range of functions for image manipulation, including filtering, transformation, and color space conversion.

2. Computer Vision: OpenCV supports various computer vision tasks, such as face detection, object recognition, and motion tracking.

3. Machine Learning: The library includes algorithms for classification, regression, and clustering, making it useful for building machine learning models.

4. Cross-Platform: OpenCV is compatible with multiple operating systems, including Windows, macOS, and Linux, and can be used with programming languages like Python, C++, and Java.

5. Real-Time Performance: It is optimized for real-time applications, allowing for fast processing of images and video streams.

6. Extensive Community Support: Being an open-source project, OpenCV has a large community of developers and users, which means a wealth of tutorials, documentation, and forums are available for support.

OpenCV is widely used in various fields, including robotics, augmented reality, medical imaging, and more.
🔥1
I'm Thinking About Creating A Tutorial About OpenCV Android SDK In Sketchware Pro. But Before I Start I Want To Be Sure How Many Of You Want This Tutorial.
🥰1
Do You Want OpenCV Android SDK Tutorial In Sketchware Pro
Final Results
95%
Yes
5%
No
How To Read & Display An Image File Using OpenCV

To Read & Display An Image File Using OpenCV We Can Use Mat Object.

In OpenCV, a Mat (Matrix) object is the primary data structure used to store and manipulate image data. It represents an n-dimensional array, typically used for 2D images, where each element contains pixel data (e.g., RGB or grayscale values).

To Load & Display An Image Using OpenCV Follow The Following Steps.

Step1. In The View Area Add ImageView Or Any Other Image Displaying View.

Step2. Make Sure You Select OpenCV Android SDK In The Library Manager.

Step3. In The Custom Imports Add The Following Classes From OpenCV.

import org.opencv.core.Mat; 
import org.opencv.android.Utils;
import org.opencv.imgproc.Imgproc;
import org.opencv.imgcodecs.Imgcodecs;

Step4. Load OpenCV C++ Binary Using The Following Code.

} 
static {
System.loadLibrary("opencv_java4");
}
{

Step5. In Any Event You Want(OnCreate, OnButton Click Or Any Other Event) Where You Want To Load & Display The Image Use This Code. Read Comment's For Better Understanding.

//Set The Image File Path

String ImageFilePath = "/sdcard/image_file.png";

//Read The Image File From The Specified Path In ImageFilePath String Variable & Store It In OpenCV Mat(Matrix) Object.

Mat mat = Imgcodecs.imread(ImageFilePath);

//By Default OpenCV Uses BGR(Blue, Green, Red) Color Format For The Image & As You Know Android Uses RGB(Red, Green, Blue) Color Format. So It Causes The Image To Have Unusual Color So We Need To Convert Them From BGR(Blue, Green, Red) Color Format To RGB(Red, Green, Blue) Color Format Using This Method.

Imgproc.cvtColor(mat, mat, Imgproc.COLOR_BGR2RGB);

//Create Bitmap From The Mat Object Columns & Rows.

Bitmap bitmap = Bitmap.createBitmap(mat.cols(), mat.rows(), Bitmap.Config.ARGB_8888);

//Convert The Image From OpenCV Matrix Object To Android Bitmap.

Utils.matToBitmap(mat, bitmap);

//Display The Bitmap In ImageView Called imageview1
imageview1.setImageBitmap(bitmap);
}
👍1😁1
OpenCV Image Viewer Sketchware Pro Project
How To Convert Image To Grayscale Using OpenCV

To Convert Image To Grayscale Using OpenCV Follow The Following Steps.

Step1. In The View Area Add ImageView Or Any Other Image Displaying View.

Step2. Make Sure You Select OpenCV Android SDK In The Library Manager.

Step3. In The Custom Imports Add The Following Classes From OpenCV.

import org.opencv.core.Mat; 
import org.opencv.core.CvType;
import org.opencv.android.Utils;
import android.graphics.Bitmap;
import org.opencv.imgproc.Imgproc;
import org.opencv.imgcodecs.Imgcodecs;
import android.graphics.drawable.BitmapDrawable;

Step4. Load OpenCV C++ Binary Using The Following Code.

} 
static {
System.loadLibrary("opencv_java4");
}
{

Step5. In Any Event You Want(OnCreate, OnButton Click Or Any Other Event) Where You Want To Convert The Image To Grayscale Use This Code. Read Comment's For Better Understanding.

//Get Bitmap From ImageView Called imageview1

Bitmap bitmap = ((BitmapDrawable) imageview1.getDrawable()).getBitmap();

//Initialize Mat Object For The Bitmap

Mat mat = new Mat();

//Convert The Bitmap From imageview1 To OpenCV Mat Object.

Utils.bitmapToMat(bitmap, mat);

//Initialize New Mat Object For The Grayscale Image.

Mat graymat = new Mat();

//Convert The Image Color From imageview1 RGB(Red, Green, Blue) Format To Greyscale Format.

Imgproc.cvtColor(mat, graymat, Imgproc.COLOR_RGB2GRAY);

//Convert The Grayscale Mat Object To Android Bitmap

Bitmap graybitmap = Bitmap.createBitmap(graymat.cols(), graymat.rows(), Bitmap.Config.ARGB_8888);

//Convert The Gray Mat Object To Bitmap

Utils.matToBitmap(graymat, graybitmap);

//Display The New Grayscale Image In imageview1

imageview1.setImageBitmap(graybitmap);

//Release The Mat Objects To Prevent Memory Leaks

mat.release();
graymat.release();
OpenCV Image2Grayscale Converter Sketchware Pro Project