这个for循环让我发疯了!!!需要一些建议 [英] This for loop is making me crazy!!! Need some suggestions please

查看:98
本文介绍了这个for循环让我发疯了!!!需要一些建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah

解决方案
这是最好的开始与原始图像数据,因为否则数据将迷失在过程.当您单击按钮时,现在的结果将是每次相同.否则,将在已经标准化的图像上进行标准化,并且最终该图像将根本不正常.就像您要使所有值稍微接近平均值一样.如果一遍又一遍地重复该过程,最终所有值将只是平均值.

祝您好运!


也许我在计算中犯了一个错误,无论如何,您的翻译信息可能会被写成

d'' r,b = d r,b -S r (d r,b )/S r + S rb (d r,b )/S rb



其中

  • S r 是索引r上的总和
  • S rb 是索引r,b上的总和.


该公式可能被重写为

d'' r,b = d r,b -F(b)+ G



如果再次应用转换,则将获得(经过一些计算)

d" r,b = d r,b -2 F(b)+ 2 G



等等.


顺便说一句,在已发布的代码中存在一些编程错误(例如,您忘记释放一些已分配的内存,而将C++delete用于分配有Cmalloc的内存).


blahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblahblah

解决方案

It is best to start with the original image data because otherwise data would get lost in the process. When you click the button the result now would be the same every time. Otherwise the normalization would be done on an already normalized image and eventually the image won''t be normal at all. It''s like when you would bring all the values somewhat closer the average. If you repeat that process over and over, eventually all the values will just be the average.

Good luck!


Maybe I made a mistake in my computations, anyway, your trasnformation migh be written

d''r,b = dr,b - Sr(dr,b)/Sr + Srb(dr,b)/Srb



where

  • Sr is sum on index r
  • Srb is sum on indices r,b.


The formula maybe re-written as

d''r,b = dr,b - F(b) + G



If you apply again the transformation, then you obtain (after some calculations)

d"r,b = dr,b - 2 F(b) + 2 G



and so on.


BTW there are some programming mistakes in the posted code (for instance, you forgot to free some allocated memory and you used C++''s delete for memory allocated with C''s malloc).


这篇关于这个for循环让我发疯了!!!需要一些建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆