且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法将类型'double'隐式转换为'int'。存在显式转换(您是否错过了演员?)

更新时间:2023-02-13 08:22:19

是的你可以

动态数组c#...... [ ^ ]





列表< double> list = new List< double>();

list.Add(12);

list.Add(12);

控制台。 WriteLine(列表[1]);





如果有效请标记解决方案或评价解决方案

>

  double  averageValue =(( double )colorValue.R +( double )colorValue.B +( double )colorValue.G)/ 3d;  //  获取黑白的平均值 
int threshold =( int )(averageValue * 0 .9d);


是的,你可以

动态数组c#...... [ ^ ]

i'm using the code below to find a threshold value of white pixels so that i can distinguish white pixel's from "whiter" ones.Any ideas on how to improve the code above to avoid the error I'm getting?



Color  colorValue=image.GetPixel(x,y);
       var averageValue = ((int)colorValue.R + (int)colorValue.B + (int)colorValue.G)/3; // get the average for black and white
      int  threshold=averageValue * 0.9;

yes you can
dynamic array c#......[^]


List<double> list = new List<double>();
list.Add(12);
list.Add(12);
Console.WriteLine(list[1]);


if it work please mark are solution or rate the solution


double averageValue = ((double)colorValue.R + (double)colorValue.B + (double)colorValue.G)/3d; // get the average for black and white
      int  threshold=(int)(averageValue * 0.9d);


yes you can
dynamic array c#......[^]