summaryrefslogtreecommitdiff
path: root/include/linux/media-bus-format.h
diff options
context:
space:
mode:
authorJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-10-12 07:50:02 +0200
committerJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>2021-10-22 07:29:53 +0200
commit02686a052a0c46741592079bc403b25ee716c356 (patch)
tree285a7130c08e07e4d553b2f5fc2ac3d17b5abdbc /include/linux/media-bus-format.h
parentfac6734a4f1de85a58963d984300f45143508b3a (diff)
ipa: ipu3: agc: Rename exposure values properly
The exposure value is filtered in filterExposure() using the currentExposure_ and setting a prevExposure_ variable. This is misnamed as it is not the previous exposure, but a filtered value. Rename it accordingly. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'include/linux/media-bus-format.h')
0 files changed, 0 insertions, 0 deletions
; using namespace std; namespace { class ConfigurationSet : public CameraTest, public Test { public: ConfigurationSet() : CameraTest("platform/vimc.0 Sensor B") { } protected: int init() override { if (status_ != TestPass) return status_; config_ = camera_->generateConfiguration({ StreamRole::VideoRecording }); if (!config_ || config_->size() != 1) { cout << "Failed to generate default configuration" << endl; return TestFail; } return TestPass; } int run() override { StreamConfiguration &cfg = config_->at(0); if (camera_->acquire()) { cout << "Failed to acquire the camera" << endl; return TestFail; } /* Test that setting the default configuration works. */ if (camera_->configure(config_.get())) { cout << "Failed to set default configuration" << endl; return TestFail; } /* * Test that configuring the camera fails if it is not * acquired, this will also test release and reacquiring * of the camera. */ if (camera_->release()) { cout << "Failed to release the camera" << endl; return TestFail; } if (!camera_->configure(config_.get())) { cout << "Setting configuration on a camera not acquired succeeded when it should have failed" << endl; return TestFail; } if (camera_->acquire()) { cout << "Failed to acquire the camera" << endl; return TestFail; } /* * Test that modifying the default configuration works. Doubling * the default configuration of the VIMC camera is known to * work. */ cfg.size.width *= 2; cfg.size.height *= 2; if (camera_->configure(config_.get())) { cout << "Failed to set modified configuration" << endl; return TestFail; } /* * Test that setting an invalid configuration fails. */ cfg.size = { 0, 0 }; if (!camera_->configure(config_.get())) { cout << "Invalid configuration incorrectly accepted" << endl; return TestFail; } return TestPass; } std::unique_ptr<CameraConfiguration> config_; }; } /* namespace */ TEST_REGISTER(ConfigurationSet) str"> (is that a word?) """ result = optimize.minimize(f, initial_guess, method='Nelder-Mead') """ need to check if the fit worked correectly """ if result.success: slope, offset = result.x Cam.log += '\nFit result: slope = {:.5f} '.format(slope) Cam.log += 'offset = {}'.format(int(offset)) """ optional plotting code """ if plot: x = np.linspace(max(g0)*1.1, 100) y = slope*x + offset plt.title('GEQ Asymmetric \'Upper Bound\' Fit') plt.plot(x, y, color='red', ls='--', label='fit') plt.scatter(g0, gdiff, color='b', label='data') plt.ylabel('Difference in green channels') plt.xlabel('Green value') """ This upper bound asymmetric gives correct order of magnitude values. The pipeline approximates a 1st derivative of a gaussian with some linear piecewise functions, introducing arbitrary cutoffs. For pessimistic geq, the model parameters have been increased by a scaling factor/constant. Feel free to tune these or edit the json files directly if you belive there are still mazing effects left (threshold too low) or if you think it is being overcorrected (threshold too high). We have gone for a one size fits most approach that will produce acceptable results in most applications. """ slope *= 1.5 offset += 201 Cam.log += '\nFit after correction factors: slope = {:.5f}'.format(slope) Cam.log += ' offset = {}'.format(int(offset)) """ clamp offset at 0 due to pipeline considerations """ if offset < 0: Cam.log += '\nOffset raised to 0' offset = 0 """ optional plotting code """ if plot: y2 = slope*x + offset plt.plot(x, y2, color='green', ls='--', label='scaled fit') plt.grid() plt.legend() plt.show() """ the case where for some reason the fit didn't work correctly Transpose data and then least squares linear fit. Transposing data makes it robust to many patches where green difference is the same since they only contribute to one error minimisation, instead of dragging the entire linear fit down. """ else: print('\nError! Couldn\'t fit asymmetric lest squares') print(result.message) Cam.log += '\nWARNING: Asymmetric least squares fit failed! ' Cam.log += 'Standard fit used could possibly lead to worse results' fit = np.polyfit(gdiff, g0, 1) offset, slope = -fit[1]/fit[0], 1/fit[0] Cam.log += '\nFit result: slope = {:.5f} '.format(slope) Cam.log += 'offset = {}'.format(int(offset)) """ optional plotting code """ if plot: x = np.linspace(max(g0)*1.1, 100) y = slope*x + offset plt.title('GEQ Linear Fit') plt.plot(x, y, color='red', ls='--', label='fit') plt.scatter(g0, gdiff, color='b', label='data') plt.ylabel('Difference in green channels') plt.xlabel('Green value') """ Scaling factors (see previous justification) The model here will not be an upper bound so scaling factors have been increased. This method of deriving geq model parameters is extremely arbitrary and undesirable. """ slope *= 2.5 offset += 301 Cam.log += '\nFit after correction factors: slope = {:.5f}'.format(slope) Cam.log += ' offset = {}'.format(int(offset)) if offset < 0: Cam.log += '\nOffset raised to 0' offset = 0 """ optional plotting code """ if plot: y2 = slope*x + offset plt.plot(x, y2, color='green', ls='--', label='scaled fit') plt.legend() plt.grid() plt.show() return round(slope, 5), int(offset) """" Return green channels of macbeth patches returns g0, g1 where > g0 is green next to red > g1 is green next to blue """ def geq(Cam, Img): Cam.log += '\nProcessing image {}'.format(Img.name) patches = [Img.patches[i] for i in Img.order][1:3] g_patches = np.array([(np.mean(patches[0][i]), np.mean(patches[1][i])) for i in range(24)]) Cam.log += '\n' return(g_patches)