comparison web/calibrate/Light9Camera.ts @ 2420:d5750b2aaa9e

minor cam edits
author drewp@bigasterisk.com
date Tue, 21 May 2024 14:50:01 -0700
parents e3af0ac507c8
children
comparison
equal deleted inserted replaced
2419:e3af0ac507c8 2420:d5750b2aaa9e
83 const stream = await navigator.mediaDevices.getUserMedia(constraints); 83 const stream = await navigator.mediaDevices.getUserMedia(constraints);
84 const t = stream.getVideoTracks()[0]; 84 const t = stream.getVideoTracks()[0];
85 await t.applyConstraints({ 85 await t.applyConstraints({
86 brightness: 0, 86 brightness: 0,
87 contrast: 32, 87 contrast: 32,
88 colorTemperature: 6600, 88 colorTemperature: 4600,
89 exposureMode: "manual", 89 exposureMode: "manual",
90 exposureTime: 250, 90 exposureTime: 250,
91 whiteBalanceMode: "manual", 91 whiteBalanceMode: "manual",
92 focusMode: "manual", 92 // this could stop focus from moving around, but it also makes my cam
93 focusDistance: 235, 93 // click on every page reload
94 // focusMode: "manual",
95 // focusDistance: 235,
94 } as MediaTrackConstraints); 96 } as MediaTrackConstraints);
95 97
96 this.vtrack = t; 98 this.vtrack = t;
97 this.videoEl.srcObject = stream; 99 this.videoEl.srcObject = stream;
98 this.videoEl.play(); 100 this.videoEl.play();
153 } 155 }
154 `, 156 `,
155 ]; 157 ];
156 158
157 boring = [ 159 boring = [
160 "autoGainControl",
158 "aspectRatio", 161 "aspectRatio",
159 "backgroundBlur", 162 "backgroundBlur",
160 "channelCount", 163 "channelCount",
161 "deviceId", 164 "deviceId",
162 "displaySurface", 165 "displaySurface",
199 return html`<table> 202 return html`<table>
200 ${rows} 203 ${rows}
201 </table>`; 204 </table>`;
202 } 205 }
203 206
204 private renderRow(key: string, rows: any[]) { 207 private renderRow(key: string, out: TemplateResult<1>[]) {
205 let valueDisplay = ""; 208 let valueDisplay = "";
206 if (this.videoSettings[key] !== undefined) { 209 if (this.videoSettings[key] !== undefined) {
207 valueDisplay = JSON.stringify(this.videoSettings[key]); 210 valueDisplay = JSON.stringify(this.videoSettings[key]);
208 } 211 }
209 let adjuster = html``; 212 let adjuster = html``;
211 if (conf !== undefined) { 214 if (conf !== undefined) {
212 adjuster = html` 215 adjuster = html`
213 <input type="range" min="${conf.min}" max="${conf.max}" value="${this.videoSettings[key]}" data-param="${key}" @input=${this.setFromSlider} /> 216 <input type="range" min="${conf.min}" max="${conf.max}" value="${this.videoSettings[key]}" data-param="${key}" @input=${this.setFromSlider} />
214 `; 217 `;
215 } 218 }
216 rows.push( 219 out.push(
217 html`<tr> 220 html`<tr>
218 <td>${key}</td> 221 <td>${key}</td>
219 <td>${valueDisplay}</td> 222 <td>${valueDisplay}</td>
220 <td>${adjuster}</td> 223 <td>${adjuster}</td>
221 </tr>` 224 </tr>`