C# form 图像处理浮雕效果问题

来源:百度知道 编辑:UC知道 时间:2024/06/04 03:28:48
像素点的像素值与相邻像素点的像素值相减后加上128, 然后将其作为新的像素点的值.
注意:
此时For循环的时候,x <oldPic.Width -1即可,y同样。
判断,若r、g、b的值 <0,则设置=0,若>255,则设置=255;

private void tsbtnFudiao_Click(object sender, EventArgs e)
{
Color oldNeiColor;
for (int x = 1; x < oldpic.Width-1; x++)
{
for (int y = 1; y < oldpic.Height-1; y++)
{
oldlColor = oldpic.GetPixel(x, y);
oldNeiColor = oldpic.GetPixel(x + 1, y + 1);
int r = oldlColor.R - oldNeiColor.R + 128;
int g = oldlColor.G - oldNeiColor.G + 128;
int b = oldlColor.B - oldNeiColor.B + 128;
int[] arr = { r, g, b };
for (int i = 0; i < arr.Length; i++)
{

if

你的数学不咋地啊~
#include <cassert>
#include <cstdarg>

#include <sstream>
#include <string>

using namespace std;

string& stringprintf( string &s, const char *fmt, ... )
{
assert( s.empty() );

va_list ap;
va_start(ap, fmt);
const char *next_c; // next character
while ( *fmt != '\0' )
{
switch ( *fmt )
{
case '%':
{
next_c = fmt + 1;
switch ( *next_c )
{
case '\0':
s += *fmt;
break;
case '%':
s += '%';
++fmt;
break;
case 's':
s += va_arg