Problem
This code checks 2 images’ pixels, compares each pixels based on the threshold (<= 7), finds a best fitting watermark image from the system given 6 images, and loads that image next to the cover image.
For a 100*100 watermark image this particular code takes nearly 130 secs to give output.
Please suggest some ways to optimize it regarding execution time.
namespace Watermarking
{
public partial class Embedding_Pixels_Evaluation : Form
{
private Stopwatch sp;
public Embedding_Pixels_Evaluation()
{
InitializeComponent();
sp = new Stopwatch();
button1.Enabled = false;
}
//choose watermark from system
private void button2_Click(object sender, EventArgs e)
{
sp.Start();
Boolean imageSize = false;
Boolean flag = false;
int[] count_miss = new int[6];
int[] count_hit = new int[6];
for (int cnt = 1; cnt <= 6; cnt++)
{
//sample watermarks saved in sampleimage folder
string curpath = Application.StartupPath.ToString() + @"sampleimage"
Solution