using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Drawing.Imaging;
namespace SkinAnalyzer
{
public class ImageProcessing
{
//--------------------------------------------------------------------------------------------
public ImageProcessing()
{
// init., if necessary
}
//--------------------------------------------------------------------------------------------
// get the features
public bool GetSkinFeatures(Bitmap Input_Bitmap, Rectangle ROI_Rect, double[] ExtractedFeatures)
{
// check the parameters
if (Input_Bitmap == null)
return false;
if (Input_Bitmap.PixelFormat != PixelFormat.Format8bppIndexed &&
Input_Bitmap.PixelFormat != PixelFormat.Format24bppRgb &&
Input_Bitmap.PixelFormat != PixelFormat.Format32bppArgb &&
Input_Bitmap.PixelFormat != PixelFormat.Format32bppRgb)
return false;
// get the input pixels
Rectangle rect1 = new Rectangle(0, 0, Input_Bitmap.Width, Input_Bitmap.Height);
BitmapData input_data = Input_Bitmap.LockBits(rect1, ImageLockMode.ReadOnly, Input_Bitmap.PixelFormat);
IntPtr ptr1 = input_data.Scan0;
int bytesbpp = 0; // bytes_per_pixel
switch (Input_Bitmap.PixelFormat)
{