In fact, this small program is only used to better solve the problems encountered. What problems?
Currently, I am working on image processing. I used CCD to take hundreds of images in batches and named them 1.bmp, 2.bmp, and 3.bmp... , In order, because some images are blurred or non-conforming
Condition, I manually remove it, so with the problem mentioned just now, a large number of image file names are not continuous, and it is not convenient to use Matlab for processing. So I wrote a C # applet to automatically arrange images.
I'm a cainiao. If you have better solutions and algorithms, please advise me a lot. The Code is as follows:
Code
1 using System;
2 using System. Collections. Generic;
3 using System. Text;
4 using System. IO;
5 using System. Windows. Forms;
6 // automatically rename
7 namespace renamebmp
8 {
9 class Program
10 {
11 static void Main (string [] args)
12 {
13 int first = 1; // start Image number
14 int last = 301; // end image number
15 int temp;
16 string path1; // The first empty position found
17 string path2; // the path of the image file with the minimum serial number after the empty position found
18 int count = 0; // number of images
19 string temppath = "";
20 for (int k = first; k <= last; k ++)
21 {
22 temppath = "F: \ test6 \" + k. ToString () + ". bmp ";
23 if (File. Exists (temppath ))
24 count ++;
25}
26 for (int I = first; I <= count; I ++)
27 {
28