diff --git a/alg/libqr.cpp b/alg/libqr.cpp index 585044c..17bef80 100644 --- a/alg/libqr.cpp +++ b/alg/libqr.cpp @@ -95,12 +95,10 @@ bool detect_qr(ProcessState &ps, float margin_ratio, bool warp, string &err) } int qr_width = max_x - min_x; int qr_height = max_y - min_y; - float min_ratio = 0.3; - int min_width = std::max(180, (int)(ps.orig->cols * min_ratio)); - int min_height = std::max(180, (int)(ps.orig->rows * min_ratio)); - if (qr_width < min_width && qr_height < min_height) { - err = string_format("qr too small: %d x %d, thres: %d x %d", - qr_width, qr_height, min_width, min_height); + int min_px = 200; + if (qr_width < min_px && qr_height < min_px) { + err = string_format("qr too small: %d x %d, min: %d", + qr_width, qr_height, min_px); return false; } diff --git a/web/public/camera-6.0/Makefile b/web/public/camera-6.0/Makefile new file mode 100644 index 0000000..e3d14cc --- /dev/null +++ b/web/public/camera-6.0/Makefile @@ -0,0 +1,2 @@ +deploy: + rsync -zrP * oci:/data/emblem-camera/ diff --git a/web/public/camera-6.0/css/loading.css b/web/public/camera-6.0/css/loading.css new file mode 100644 index 0000000..6e4c6d6 --- /dev/null +++ b/web/public/camera-6.0/css/loading.css @@ -0,0 +1,85 @@ +.lds-roller { + display: inline-block; + position: relative; + width: 80px; + height: 80px; +} +.lds-roller div { + animation: lds-roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite; + transform-origin: 40px 40px; +} +.lds-roller div:after { + content: " "; + display: block; + position: absolute; + width: 7px; + height: 7px; + border-radius: 50%; + background: #666; + margin: -4px 0 0 -4px; +} +.lds-roller div:nth-child(1) { + animation-delay: -0.036s; +} +.lds-roller div:nth-child(1):after { + top: 63px; + left: 63px; +} +.lds-roller div:nth-child(2) { + animation-delay: -0.072s; +} +.lds-roller div:nth-child(2):after { + top: 68px; + left: 56px; +} +.lds-roller div:nth-child(3) { + animation-delay: -0.108s; +} +.lds-roller div:nth-child(3):after { + top: 71px; + left: 48px; +} +.lds-roller div:nth-child(4) { + animation-delay: -0.144s; +} +.lds-roller div:nth-child(4):after { + top: 72px; + left: 40px; +} +.lds-roller div:nth-child(5) { + animation-delay: -0.18s; +} +.lds-roller div:nth-child(5):after { + top: 71px; + left: 32px; +} +.lds-roller div:nth-child(6) { + animation-delay: -0.216s; +} +.lds-roller div:nth-child(6):after { + top: 68px; + left: 24px; +} +.lds-roller div:nth-child(7) { + animation-delay: -0.252s; +} +.lds-roller div:nth-child(7):after { + top: 63px; + left: 17px; +} +.lds-roller div:nth-child(8) { + animation-delay: -0.288s; +} +.lds-roller div:nth-child(8):after { + top: 56px; + left: 12px; +} +@keyframes lds-roller { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} + diff --git a/web/public/camera-6.0/css/main.css b/web/public/camera-6.0/css/main.css new file mode 100644 index 0000000..902a937 --- /dev/null +++ b/web/public/camera-6.0/css/main.css @@ -0,0 +1,464 @@ +body { + margin: 0; + padding: 0; + font-family:Tahoma,Verdana,STHeiTi,simsun,sans-serif; +} +div.debug { + position: absolute; + left: 5px; + bottom: 5px; + width: 80%; + height: 50%; + border-radius: 10px; + border: 2px dashed rgba(50, 255, 50, 0.5); + background-color: rgba(0, 50, 0, 0.7); + padding: 1rem; + color: #fff; + font-size: 12px; + word-break: break-all; +} +.hidden { + display: none !important; +} +video.preview { + object-fit: cover; + position: fixed; + top: -1%; + left: -1%; + width: 102%; + height: 102%; + z-index: -1000; + border: 1px solid yellow; + box-sizing: border-box; +} +div.debug canvas { + display: inline-block; + width: 100px; + height: 100px; +} +div.bottomfixed { + position: absolute; + width: 100%; + bottom: 0; + height: 90px; + background-color: #171616; + text-align: center; + border-top: 1px solid #ef4823; +} + +.play.button { + display: inline-block; + padding: 0.1rem 1.2rem 0.1rem 1.4rem; + margin-right: 0.2rem; + border-radius: 6px; + background-color: #707070; + color: #444; +} + +div.bottomfixed .action.highlight .play.button { + background-color: #ccc; +} + +div.bottomfixed .action img { + height: 14px; + width: 36px; +} + +div.bottomfixed .action { + margin-top: 20px; + font-size: 1rem; + color: #707070; + width: 49%; + display: inline-block; +} + +div.bottomfixed .action.highlight { + color: #ccc; +} + +div.camoverlay { + position: fixed; + top: 0; + clear: both; + font-size: 0; + width: 100%; + aspect-ratio: 1; + top: 18vw; +} +div.camoverlay img.qrmarkers { + position: absolute; + left: 0; + margin: 0; + width: 100%; + height: 100%; +} + +div.lower.text { + top: 4%; + text-align: center; +} + +div.progress { + width: 70%; + margin: 0.2rem 0 0 0; + height: 20px; + border-radius: 10px; + background-color: #eee; + font-size: 18px; + color: black; + display: inline-block; + position: relative; + overflow: hidden; +} +div.progress-text { + color: #333; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} +div.progress-bar { + border-radius: 10px; + background-color: #ef4823; + width: 0%; + height: 100%; + top: 0; +} +div.upper.overlay { + position: relative; + height: 100vmin; + text-align: center; +} + +div.lower.overlay { + position: relative; + width: 100%; + text-align: center; +} +div.debug .buttons { + margin: 0 0 0.3rem 0; +} +div.debug .buttons button { + height: 2rem; + margin: 0 5px 5px 0; +} + +div#loading { + width: 100%; + height: 100%; + position: absolute; + background-color: white; + z-index: 10000; + text-align: center; + padding-top: 30%; +} + +canvas#output_img { + position: absolute; + right: 5px; + top: 5px; +} + +div.bordered { + padding: 0.2rem; + border: 1px dashed yellow; + border-radius: 4px; + margin: 0.2rem 0; +} + +div.output { + position: relative; +} + +.tooltip { + position: absolute; + width: 100vmin; + display: block; + margin: 0 auto; + animation: bounce 1s ease-in-out infinite; /* Adjust the duration as needed */ + top: -60px; +} + +.tooltip .tooltiptext { + display: block; + margin: 0 auto; + width: 110px; + background-color: #ef4823; + color: #fff; + padding: 12px 0; + border-radius: 10px; + z-index: 1; + opacity: 0.75; +} + +.tooltip:hover .tooltiptext { +} +.tooltip .tooltiptext::after { + content: " "; + position: absolute; + top: 100%; /* At the bottom of the tooltip */ + left: 50%; + margin-left: -5px; + border-width: 5px; + border-style: solid; + border-color: #ef4823 transparent transparent transparent; +} + +@keyframes bounce { + 0%, 100% { + transform: translateY(0); + } + 50% { + transform: translateY(10px); /* Adjust the bounce height as needed */ + } +} + +.modal { + display: block; + width: 100%; + height: 100%; + position: fixed; + background-color: rgba(0, 0, 0, 0.9); + z-index: 100; +} + +.modal .panel { + position: relative; + width: 80vmin; + height: 80%; + margin: 10vmin auto; + background-image: linear-gradient(0deg, #8b8986 0%, #414141 36%, #414141 92%, #515151 100%); + border-radius: 20px; +} + +.modal .actions { + position: absolute; + display: block; + width: 100%; + height: 100px; + bottom: 0; + text-align: center; +} + +.actions button { + display: inline-block; + width: 35%; + border-radius: 10px; + box-sizing: border-box; + font-size: 0.8rem; + border-radius: 20rpx; + padding: 0.4rem 1.5rem; +} + +button.service { + margin-right: 0.5rem; + border: 1px solid #676767; + background-color: #858585; + color: #a7a7a7; +} + +button.back { + border: 1px solid rgba(239, 72, 35, 0.7); + color: rgba(239, 72, 35, 0.7); + margin-left: 0.5rem; +} + +button.back img.return { + width: 10px; + height: 10px; +} + +.serviceqr { + position: relative; + width: 100%; + padding-top: 80px; +} + +.serviceqr .imgbox { + display: block; + margin: auto; + width: 60vmin; + height: 60vmin; + padding: 3vmin; + background-color: #eee; + border-radius: 10px; +} + +.serviceqr .title { + position: absolute; + display: inline-block; + width: 100%; + color: #eee; + margin: 30px auto; + text-align: center; + padding: 0; +} + +.serviceqr img { + width: 100%; + height: 100%; +} + +.verifyfailed { + text-align: center; + color: #eee; +} + +.verifyfailed .title { + font-size: 1.1rem; +} + +.verifyfailed .hints { + margin-top: 80px; + color: #ccc; +} + +.verifyfailed .hints div { + margin-bottom: 0.3rem; +} + +.verifyfailed .circle { + height: 20vmin; + width: 20vmin; + color: #666; + font-size: 15vmin; + margin: 10vmin auto 1rem;; + background-color: #ddd; + border-radius: 50%; + display: inline-block; +} + +.verifyspin { + position: absolute; + overflow: hidden; + z-index: 101; + width: 100vmin; + height: 100vmax; + background-color: rgba(0, 0, 0, 0.9); +} + +.verifyspin .spinner { + position: absolute; /* Position the image absolutely */ + width: 100vmin; + height: 100vmin; + margin: 0 auto; + text-align: center; + display: block; +} + +.verifyspin img { + display: block; + width: 100%; + height: 100%; +} + +.spin-and-shrink { + animation: spin-and-shrink 3s linear forwards; +} + +@keyframes spin-and-shrink { + 0% { + transform: rotate(-90deg) scale(5.5) + } + 10% { + transform: rotate(0deg) scale(2.0) + } + 33% { + transform: rotate(90deg) scale(1.0); + } + 66% { + transform: rotate(2000deg) scale(0.5); + } + 99% { + transform: rotate(3600deg) scale(0.2); + } + 100% { + transform: rotate(3600deg) scale(0.2); + } +} + +.spin-only { + animation: spin-only 0.3s linear infinite; +} + +@keyframes spin-only { + 0% { + transform: rotate(0deg) scale(0.2); + } + 100% { + transform: rotate(360deg) scale(0.2); + } +} + +.verifyspin .loading { + color: #ccc; + font-size: 1.4rem; + display: block; + width: 100%; + margin: 110vmin auto; + text-align: center; +} + +div.scanguide { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +#hint { + display: inline-block; + margin: 10px auto; + padding: 12px 40px; + border-radius: 10px; + background-color: rgba(0, 0, 0, 0.7); + color: #eee; + font-size: 20px; +} + +div.qrarc { + position: absolute; + box-sizing: border-box; + width: 46vw; + height: 46vw; + margin: 35vw 27vw; + animation: qrarc-anime 1.2s ease-in-out infinite; +} + +div.qrarc img.arc { + position: absolute; + width: 15%; + height: 15%; + opacity: 0.9; + display: block; +} + +div.qrarc img.arc.topright { + right: 0; + transform: rotate(90deg); +} + +div.qrarc img.arc.bottomleft { + bottom: 0; + transform: rotate(-90deg); +} + +div.qrarc img.arc.bottomright { + bottom: 0; + right: 0; + transform: rotate(180deg); +} + + +@keyframes qrarc-anime { + 0% { + transform: scale(1); + } + 50% { + transform: scale(1.05); + } + 100% { + transform: scale(1); + } +} diff --git a/web/public/camera-6.0/images/arc.png b/web/public/camera-6.0/images/arc.png new file mode 100644 index 0000000..bc3a238 Binary files /dev/null and b/web/public/camera-6.0/images/arc.png differ diff --git a/web/public/camera-6.0/images/black.png b/web/public/camera-6.0/images/black.png new file mode 100644 index 0000000..4eb7ece Binary files /dev/null and b/web/public/camera-6.0/images/black.png differ diff --git a/web/public/camera-6.0/images/camoverlay.png b/web/public/camera-6.0/images/camoverlay.png new file mode 100644 index 0000000..1d9ba68 Binary files /dev/null and b/web/public/camera-6.0/images/camoverlay.png differ diff --git a/web/public/camera-6.0/images/flash-button.png b/web/public/camera-6.0/images/flash-button.png new file mode 100644 index 0000000..b18cdc3 Binary files /dev/null and b/web/public/camera-6.0/images/flash-button.png differ diff --git a/web/public/camera-6.0/images/play-button.png b/web/public/camera-6.0/images/play-button.png new file mode 100644 index 0000000..aff31b1 Binary files /dev/null and b/web/public/camera-6.0/images/play-button.png differ diff --git a/web/public/camera-6.0/images/qrmarkers.png b/web/public/camera-6.0/images/qrmarkers.png new file mode 100644 index 0000000..2f47bce Binary files /dev/null and b/web/public/camera-6.0/images/qrmarkers.png differ diff --git a/web/public/camera-6.0/images/return.png b/web/public/camera-6.0/images/return.png new file mode 100644 index 0000000..b71e5ec Binary files /dev/null and b/web/public/camera-6.0/images/return.png differ diff --git a/web/public/camera-6.0/images/right-arrow.png b/web/public/camera-6.0/images/right-arrow.png new file mode 100644 index 0000000..6aa6af0 Binary files /dev/null and b/web/public/camera-6.0/images/right-arrow.png differ diff --git a/web/public/camera-6.0/images/spinner.png b/web/public/camera-6.0/images/spinner.png new file mode 100644 index 0000000..1a62b8f Binary files /dev/null and b/web/public/camera-6.0/images/spinner.png differ diff --git a/web/public/camera-6.0/index.html b/web/public/camera-6.0/index.html new file mode 100644 index 0000000..1cd49cb --- /dev/null +++ b/web/public/camera-6.0/index.html @@ -0,0 +1,121 @@ + + +
+ + + + +
+ 验证演示
+
+ 开启补光
+ n?-1:1,l=!0;l;)if(r[a]<=n&&r[a+1]>n?(o=(n-r[a])/(r[a+1]-r[a]),l=!1):a+=h,a<0||a>=s-1){if(a===s-1)return i[a];l=!1}return i[a]+(i[a+1]-i[a])*o}var h=createTypedArray("float32",8);return{getSegmentsLength:function(t){var e,r=segmentsLengthPool.newElement(),s=t.c,a=t.v,n=t.o,o=t.i,h=t._length,l=r.lengths,p=0;for(e=0;e0;)i-=1,this._elements.unshift(e[i]);this.dynamicProperties.length?this.k=!0:this.getValue(!0)},RepeaterModifier.prototype.resetElements=function(t){var e,i=t.length;for(e=0;e0?Math.floor(m):Math.ceil(m),u=this.pMatrix.props,y=this.rMatrix.props,g=this.sMatrix.props;this.pMatrix.reset(),this.rMatrix.reset(),this.sMatrix.reset(),this.tMatrix.reset(),this.matrix.reset();var v,b,x=0;if(m>0){for(;x=0;a-=1)o=PolynomialBezier.shapeSegmentInverted(t,a),l.push(offsetSegmentSplit(o,e));l=pruneIntersections(l);var p=null,f=null;for(a=0;a0&&(p=!1),p){var f=createTag("style");f.setAttribute("f-forigin",r[i].fOrigin),f.setAttribute("f-origin",r[i].origin),f.setAttribute("f-family",r[i].fFamily),f.type="text/css",f.innerText="@font-face {font-family: "+r[i].fFamily+"; font-style: normal; src: url('"+r[i].fPath+"');}",e.appendChild(f)}}else if("g"===r[i].fOrigin||1===r[i].origin){for(h=document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]'),l=0;l=0&&!this.shapeModifiers[t].processShapes(this._isFirstFrame);t-=1);}},searchProcessedElement:function(t){for(var e=this.processedElements,i=0,r=e.length;ie);)i+=1;return this.keysIndex!==i&&(this.keysIndex=i),this.data.d.k[this.keysIndex].s},TextProperty.prototype.buildFinalText=function(t){for(var e,i,r=[],s=0,a=t.length,n=!1,o=!1,h="";s=55296&&e<=56319?FontManager.isRegionalFlag(t,s)?h=t.substr(s,14):(i=t.charCodeAt(s+1))>=56320&&i<=57343&&(FontManager.isModifier(e,i)?(h=t.substr(s,2),n=!0):h=FontManager.isFlagEmoji(t.substr(s,4))?t.substr(s,4):t.substr(s,2)):e>56319?(i=t.charCodeAt(s+1),FontManager.isVariationSelector(e)&&(n=!0)):FontManager.isZeroWidthJoiner(e)&&(n=!0,o=!0),n?(r[r.length-1]+=h,n=!1):r.push(h),s+=h.length;return r},TextProperty.prototype.completeTextData=function(t){t.__complete=!0;var e,i,r,s,a,n,o,h=this.elem.globalData.fontManager,l=this.data,p=[],f=0,m=l.m.g,c=0,d=0,u=0,y=[],g=0,v=0,b=h.getFontByName(t.f),x=0,P=getFontProperties(b);t.fWeight=P.weight,t.fStyle=P.style,t.finalSize=t.s,t.finalText=this.buildFinalText(t.t),i=t.finalText.length,t.finalLineHeight=t.lh;var E,S=t.tr/1e3*t.finalSize;if(t.sz)for(var C,_,A=!0,T=t.sz[0],M=t.sz[1];A;){C=0,g=0,i=(_=this.buildFinalText(t.t)).length,S=t.tr/1e3*t.finalSize;var k=-1;for(e=0;eT&&" "!==_[e]?(-1===k?i+=1:e=k,C+=t.finalLineHeight||1.2*t.finalSize,_.splice(e,k===e?1:0,"\r"),k=-1,g=0):(g+=x,g+=S);C+=b.ascent*t.finalSize/100,this.canResize&&t.finalSize>this.minimumFontSize&&Ms&&"slice"===o)?(i-this.transformCanvas.w*(r/this.transformCanvas.h))/2*this.renderConfig.dpr:"xMax"===l&&(as&&"slice"===o)?(i-this.transformCanvas.w*(r/this.transformCanvas.h))*this.renderConfig.dpr:0,this.transformCanvas.ty="YMid"===p&&(a>s&&"meet"===o||as&&"meet"===o||a=0;t-=1)this.elements[t]&&this.elements[t].destroy&&this.elements[t].destroy();this.elements.length=0,this.globalData.canvasContext=null,this.animationItem.container=null,this.destroyed=!0},CanvasRendererBase.prototype.renderFrame=function(t,e){if((this.renderedFrame!==t||!0!==this.renderConfig.clearCanvas||e)&&!this.destroyed&&-1!==t){var i;this.renderedFrame=t,this.globalData.frameNum=t-this.animationItem._isFirstFrame,this.globalData.frameId+=1,this.globalData._mdf=!this.renderConfig.clearCanvas||e,this.globalData.projectInterface.currentFrame=t;var r=this.layers.length;for(this.completeLayers||this.checkLayers(t),i=r-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&this.elements[i].prepareFrame(t-this.layers[i].st);if(this.globalData._mdf){for(!0===this.renderConfig.clearCanvas?this.canvasContext.clearRect(0,0,this.transformCanvas.w,this.transformCanvas.h):this.save(),i=r-1;i>=0;i-=1)(this.completeLayers||this.elements[i])&&this.elements[i].renderFrame();!0!==this.renderConfig.clearCanvas&&this.restore()}}},CanvasRendererBase.prototype.buildItem=function(t){var e=this.elements;if(!e[t]&&99!==this.layers[t].ty){var i=this.createItem(this.layers[t],this,this.globalData);e[t]=i,i.initExpressions()}},CanvasRendererBase.prototype.checkPendingElements=function(){for(;this.pendingElements.length;){this.pendingElements.pop().checkParenting()}},CanvasRendererBase.prototype.hide=function(){this.animationItem.container.style.display="none"},CanvasRendererBase.prototype.show=function(){this.animationItem.container.style.display="block"},CVContextData.prototype.duplicate=function(){var t=2*this._length,e=0;for(e=this._length;e1?e=1:e<0&&(e=0);var n=t(e);if($bm_isInstanceOfArray(s)){var o,h=s.length,l=createTypedArray("float32",h);for(o=0;o