BufferedImage Equivalent from Java to C #

I am trying to convert a Java program to C # and I don't know the BufferedImage equivalent from Java to C # ...

Code from Java:

public static String ActiveContour(int x11, int x22, int y11, int y22, BufferedImage bufIm, int contor) { double [][] img=new double[bufIm.getHeight()][bufIm.getWidth()]; double [][] imgf=new double[bufIm.getHeight()][bufIm.getWidth()]; w=bufIm.getWidth(); h=bufIm.getHeight(); for(int i=0;i<h;i++) for(int j=0;j<w;j++) { img[i][j]=bufIm.getRGB(j, i); c = new Color((int)img[i][j]); img[i][j]= 0.2898*c.getRed() + 0.5870*c.getGreen() + 0.1140*c.getBlue(); } 

Am I missing instructions?

 using System...; 

because in java i have

 import java.awt.image.BufferedImage; 
+4
source share
2 answers

System.Drawing.Bitmap is the closest I can think of.

+5
source

What does this function do? Why bother translating code by bit when there is most likely another way to achieve the same result using C # classes? In C # using System.Drawing.Bitmap is common practice, but there are other ways depending on what the code should do.

+1
source

Source: https://habr.com/ru/post/1336717/


All Articles