Exemplo n.º 1
0
        static double SimulateCamera(ImageSensor sensor, double input)
        {
            Matrix <double> sensor_input = Matrix <double> .Build.Dense(sensor.Rows, sensor.Columns);

            double[] sensor_input_arr = sensor_input.AsColumnMajorArray();
            for (int k = 0; k < sensor_input_arr.Length; k++)
            {
                sensor_input_arr[k] = input;
            }
            Matrix <double> sensor_result = sensor.Simulate(sensor_input);

            return(sensor_result[0, 0]);
        }
Exemplo n.º 2
0
        public static Matrix <double> GenerateTestPattern(ImageSensor sensor, double incident_ph_flux)
        {
            Matrix <double> test_target = Matrix <double> .Build.Dense(sensor.Rows, sensor.Columns);

            int  fringe_width = 1;
            int  col_start = 1, col_end = col_start + fringe_width;
            bool end = false;

            while (!end)
            {
                for (int row = 0; row < test_target.RowCount / 2; row++)
                {
                    for (int col = col_start; col < test_target.ColumnCount && col < col_end; col++)
                    {
                        test_target[row, col] = 1.0;
                    }
                }
                for (int row = test_target.RowCount / 2; row < test_target.RowCount; row++)
                {
                    for (int col = col_start; col < test_target.ColumnCount && col < col_end; col++)
                    {
                        test_target[row, col] = ((double)col) / test_target.ColumnCount;
                    }
                }
                fringe_width++;
                col_start += 2 * fringe_width;
                col_end    = col_start + fringe_width;

                if (col_end >= test_target.ColumnCount)
                {
                    end = true;
                }
            }

            test_target *= incident_ph_flux;

            test_target = test_target.Transpose();

            return(sensor.Simulate(test_target));
        }