iphone11相机为什么只能放大5倍?
创新互联专注为客户提供全方位的互联网综合服务,包含不限于网站制作、做网站、楚雄州网络推广、微信小程序、楚雄州网络营销、楚雄州企业策划、楚雄州品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;创新互联为所有大学生创业者提供楚雄州建站搭建服务,24小时服务热线:18980820575,官方网址:www.cdcxhl.com
程序鹅 
码龄5年
关注
在做扫码需求,往往会有放大镜头需求。
苹果提供了AVCaptureConnection中,videoScaleAndCropFactor:缩放裁剪系数,使用该属性,可以实现拉近拉远镜头。再结合手势UIPinchGestureRecognizer,就很简单实现手势拉近拉远镜头。
手势代码
///记录开始的缩放比例
@property(nonatomic,assign)CGFloat beginGestureScale;
///最后的缩放比例
@property(nonatomic,assign)CGFloat effectiveScale;
- (void)cameraInitOver
{
if (self.isVideoZoom) {
UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchDetected:)];
pinch.delegate = self;
[self.view addGestureRecognizer:pinch];
}
}
- (void)pinchDetected:(UIPinchGestureRecognizer*)recogniser
{
self.effectiveScale = self.beginGestureScale * recogniser.scale;
if (self.effectiveScale 1.0){
self.effectiveScale = 1.0;
}
[self.scanObj setVideoScale:self.effectiveScale];
}
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
if ( [gestureRecognizer isKindOfClass:[UIPinchGestureRecognizer class]] ) {
_beginGestureScale = _effectiveScale;
}
return YES;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
拉近拉远镜头代码
- (void)setVideoScale:(CGFloat)scale
{
[_input.device lockForConfiguration:nil];
AVCaptureConnection *videoConnection = [self connectionWithMediaType:AVMediaTypeVideo fromConnections:[[self stillImageOutput] connections]];
CGFloat maxScaleAndCropFactor = ([[self.stillImageOutput connectionWithMediaType:AVMediaTypeVideo] videoMaxScaleAndCropFactor])/16;
if (scale maxScaleAndCropFactor)
scale = maxScaleAndCropFactor;
CGFloat zoom = scale / videoConnection.videoScaleAndCropFactor;
videoConnection.videoScaleAndCropFactor = scale;
[_input.device unlockForConfiguration];
CGAffineTransform transform = _videoPreView.transform;
[CATransaction begin];
[CATransaction setAnimationDuration:.025];
_videoPreView.transform = CGAffineTransformScale(transform, zoom, zoom);
[CATransaction commit];
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
有一点需要注意:the videoScaleAndCropFactor property may be set to a value in the range of 1.0 to videoMaxScaleAndCropFactor,videoScaleAndCropFactor这个属性取值范围是1.0-videoMaxScaleAndCropFactor,如果你设置超出范围会崩溃哦!
iOS 模仿微信扫描二维码放大功能
我们知道,微信扫描二维码过程中,如果二维码图片焦距比较远,会拉近焦距,实现放大功能。这种效果如何该实现,用原生的API又是如何实现。本文简单尝试如何使用AVFoundation实现放大二维码图片。重点是如何定位二维码和放大二维码,前面介绍了 iOS 扫描二维码实现手势拉近拉远镜头 iOS 识别过程中描绘二维码边框 和iOS 识别过程中描绘二维码边框 ,我们可以很简单的实现二维码定位和放大。 ...
APP打开
Android代码-Flutter实现的二维码扫描。
flutter_mobile_vision Flutter implementation for Google Mobile Vision. Based on Google Mobile Vision
APP打开
扫描二维码研究总结(高仿微信扫一扫,轻松实现定制扫描界面)
在正文之前说点题外话,加上这篇我已经写了3篇博客了,其实我写博客的初衷不是想证明自己有多牛,并且我也只是从事安卓开发只有半年时间的小渣,但是不想成为大牛的渣不是好渣,所以我想通过博客把工作学习中遇到的问题进行研究总结,从而提高自己,与此同时如果能给广大从事安卓开发的朋友们提供帮助或者是提供一点点思路我也是很心满意足了!~~好了,废话不多少进入正题吧! 先上界面图。由于目前不会录屏,所以直接上截图...
APP打开
ios 扫描二维码实现自动放大和手势双击放
[img]魔杖选择题没有答案,都是根据你个人的情况让魔杖选择你的。
分院的题目不是固定的,而是随机抽取7道题,而且也没有固定的标准答案说是选择哪个选项必然可以进入某个学院。我和楼上的童鞋某些题选择的不一样,也进了拉院。选择时要着重考虑可以代表拉文克劳品质的选项:睿智、公正、精明、博学、 聪明、有远见、好奇心强,喜欢钻研等。
有些问题还是很明显的,比如说:
1 你最讨厌别人说你什么:答案有 胆小、自私、平庸、无知。 选无知
2 如果可以研制一种魔药,你希望它能给与人:友爱、智慧、能量、荣耀。 选智慧
还有些二选一的问题有:
星星/月亮? 黑色/白色?左边/右边? 硬币的正面/反面? 破晓/黄昏?河流/森林?
按照这个标准并不能百分百进入拉院。如果不怕麻烦,可以在进入其它学院之后,关闭帐号,重新注册,重新分院,直到进入拉院为止。
Good luck!
以下是一些国外哈密摘出的问题和部分解析,不是正确答案,只是解析可能性而已,希望能对大家有所帮助。
When you die what would you most like people to do when they hear your name?
Miss you and smile--Hufflepuff
Ask for more stories about your adventures--Gryffindor
Think in admiration of your achievements--Ravenclaw
I don’t care what people think about me, when after I’m dead it’s when I’m alive that matters—slytherin
Heads or tails?
Heads—Gryffindor/Slytherin
Tails—Hufflepuff/Ravenclaw
Head 正面 -主导型人格的人
Tails 反面 — 听从或反馈他人行为的人
Stars or Moon?
Stars—Ravenclaw/Gryffindor
Moon—Slytherin/Hufflepuff
月亮代表最深层的个人需求、基本习惯和反应,以及潜意识。繁星则寓意真理和良知。
Black or White?
Black –Slytherin/Ravenclaw
White—Gryffindor/Hufflepuff
西洋棋盘中,白棋先行。Ravenclaw和Slytherin是策略型人才,他们喜欢知己知彼,后发制人。Gryffindor通常会不计后果主动出击。
Dawn or Dusk?
Dawn—Gryffindor/Hufflepuff
Dusk—Slytherin/Ravenclaw
破晓寓意新的开始和希望,是乐观主义者。
黄昏寓意哀伤及过早失望。Ravenclaw求诸事实,若事态与愿意相违背,往往会较他人更早失去希望。Slytherin会尽力扭转局势,以期对自己有利。一旦察觉大势已定,则会违背初衷随大流。Griffindor勇敢而坚定。Hufflepuff忠贞不二。
Amortenia is a potion that smells of what attracts a person. Would you smell a crackling fire, new parchment, the sea?
Crackling fire—Gryffindor/slytherin
New parchment—Ravenclaw/Hufflepuff
The sea—Gryffindor
Ravenclaw求知欲强烈,Hufflepuff勤奋,Gryffindor勇敢。
以上问题的另一个版本:
Once every century, the Flutterby Bush produces flowers that adapt their scent to attract the unwary. If it lured you, it would smell of:
The sea
Fresh parchment
Home --Hufflepuff
A crackling log fire
You are walking along and you reach a crossroad one path leads to the sea, one through a forest and a third to a castle. Which path would you choose?
Sea—Gryffindor
Forest--Gryffindor
Castle—Ravenclaw/Slytherin
Ravenclaw渴求真知,城堡是个遍布宝藏的地方。Slytherin将一切可利用资源为己所用。Gryffindor貌似更喜欢去充满各种危险生物的丛林里。
If you could create a new potion that would give you one thing what would you choose?
Love—Gryffindor/Hufflepuff
Glory—Gryffindor/Slytherin
Wisdom--Ravenclaw
If there was a fire and merlin’s book of spells, 1000 years of student record, and a nearly perfected cure for dragonpox were in danger of being destroyed in which order would you choose to save these objects?
Books, Records, Dragonpox—Ravenclaw
Dragonpox, books, records—Slytherin/Ravenclaw
Books, Dragonpox, Records—Ravenclaw/Slytherin
What do you find hardest to deal with?
* boredom
* cold
* hunger
* loneliness
* being ignored
What are you most excited to learn about at Hogwarts?
* Apparition
* Everything magic --Ravenclaw
* Transfiguration
* Flying brooms -- Gryffindor
* Hexes and curses -- Slytherin
* Magical creatures
* Exploring the castle -- Gryffindor
One of you house mates has cheated in a Hogwarts exam by using a self-spelling quill. Now he has come to top of the class in charms, beating you into second place. Professor Flitwick is suspicious of what happened. He draws you to one side after his lesson and asks you whether or not your classmate used a forbidden quill. What do you do?
-Lie and say you don’t know (but hope that somebody else tells Professor Flitwick the truth.)
-Tell Professor Flitwick that he ought to ask your classmate (and resolve to tell your classmate that if he doesn’t tell the truth, you will.)
-Tell Professor Flitwick the truth. If your classmate is prepared to win by cheating, he deserves to be found out. Also, as you are both in the same house, any points he loses will be regained by you, for coming first in his place.
-You would not wait to be asked to tell Professor Flitwick the truth. If you knew that somebody was using a forbidden quill, you would tell the teacher before the exam started.
What do you most want to be known as?
* The good -- Hufflepuff/Gryffindor
* The wise -- Ravenclaw
* The kind -- Hufflepuff
* The great -- Gryffindor/Slytherin
What power would you like to have?
-Invisibility
-Super Strength -- Slytherin
-The ability to change the past -- Slytherin
-The ability to change your appearance at will
-Mind Reading
-The ability to talk to animals
Which road tempts you the most?
-The sunny, grassy lane
-The Narrow dark lantern lit alley
-The twisting leaf-strewn path in the woods
-The cobbled street lined with ancient buildings
Four boxes are placed before you. Which do you open?
-The small tortoiseshell box, embellished with gold, inside which some small creature seems to be squeaking
-The gleaming jet black box with a silver lock and key, marked with a mysterious rune that you know to be the mark of Merlin
-The ornate golden casket, standing on clawed feet, whose inscription warms that both secret knowledge and unbearable temptation lie within
-The small pewter box, unassuming and plain, with a scratched message upon it that reads ‘I only open for the worthy’
Four goblets are placed in front of you, which would you choose to drink?
-Foaming, silvery liquid that sparkles as though containing ground diamonds
-Smooth, thick purple drink that smells of chocolate and plums
-Golden liquid, which makes sun spots dance around the room
-Mysterious black liquid, which gives the drinker strange visions
You are walking along and hear a sound. What do you do?
-Tread cautiously with you hand on your wand
-Retreat and wait for the source of the sound to reveal itself while remembering defensive spells --Slytherin/Ravenclaw
-Seek out the source of the sound -- Gryffindor
Which would you rather be?
-Liked -- Gryffindor/Hufflepuff
-Imitated -- Ravenclaw
-Praised -- Slytherin/Gryffindor
-Envied -- Slytherin/Ravenclaw
-Feared -- Slytherin
-Trusted -- Hufflepuff
A muggle confronts you and says that they are sure you are a witch or wizard. Do you:
-Ask what makes them think so?------ Ravenclaw 好奇
-Agree and walk away, leaving them wondering about the truth?
-Say yes and tell them you’ll jinx them if they don’t leave? ------Slytherin
-Tell them you think perhaps they need to call the mental hospital?
Which magical creatures would you most like to study?
-Centaurs
-Goblins
-Merpeople
-Ghosts
-Vampires
-Werewolves
-Trolls
You and your friends need to cross a bridge guarded by a river troll. He insists that one of you fight him before you can cross. What do you do?
Confuse the troll -- Ravenclaw 运用智慧策略诱敌
Have all 3 of you fight (without informing the troll) -- Slytherin 利用联合力量
Volunteer to fight -- Gryffindor 勇敢大无畏
Draw lots to see who will fight -- Hufflepuff 抽签决定 公平公正
我是初学者小白,所以很多看法不深,理解也不够透彻。但是很适合小白们一起从低角度往高处探索。文中有错误的,感谢指正,一起进步。
趁着假期做一个Flutter的地图功能,因为后端选用了百度地图,所以前端没得挑。找了遍插件,并没有现成可用的。(不过发现了百度官方也自开发Flutter插件,目前功能只有一个获取本地位置信息,后期会继续增加吧?很期待!)
参考帖子:
这个实际上跟功能之间没太大关系,只是我按照个人摸索的过程来写。
当对一个“领域/知识块”完全不懂的时候,360°的方向都不确定的话。先了解基础概念,有利于你确定自己的摸索方向。
参考帖子:
中间我跳过了几十,上百个帖子的摸索过程。这个才是关键能够真正做事的参考。
因为百度的sdk还算是很完善的,所以一旦出问题,都会有对应的报错提示。
我是使用flutter插件:permission_handler,来解决安卓的动态授权问题,用法简单而且设计合理。
这个错误直接来看,就是签名有问题。怎么查看SHA1码和包名,这里不多说,网上有极其多的方法,百度Sdk开发指南里也有。没那么复杂,也没那么麻烦。按照流程操作就是对的。
实在不放心?跟我一样,flutter打包后,把apk反过来解SHA1码不就行了?
参考帖子:
红色框框基本就是帖子讲解的那样。
蓝色框框见下图:release标签里好像是自己设置了。所以debug标签里面,箭头指向的位置,是我多设置的一个参数。
uid: -1 appid -1 msg: httpsPost failed,IOException:Unable to resolve host "api.map.baidu.com": No address associated with hostname
这一步我是哭笑不得,一开始老是和问题(2)混淆,导致浪费很多时间。仔细阅读后,发现是不能连接到“api.map.baidu.com”。
我打开模拟器的chrome浏览器,发现不能上网。查看手机的dns是10.0.2.3(默认的),和家里wifi不一样,所以不能上网也正常,之前居然没发现这个问题!!!
终端执行:adb shell 和 getprop,就可以查看所有的属性参数了。(window小伙伴自行百度,这个没多大差别。如果你有多个设备,记得自己选好设备。)
在里面找到这一项,就是你的dns参数。有些人是net.dns1,我的是net.eth0.dns1。这个没关系,只是等下指令 稍微改动 就行。
修改dns指令:setprop net.eth0.dns1 192.168.2.1
后面的192.168.2.1是我自己的dns,这个根据自己的情况来填写。不懂的百度下怎么查看自己的dns。
虽然提示设置失败,但是回到模拟器一看,地图已经显示出来了。
嘿嘿,在flutter设定多大的区域,地图就是多大的区域。用起来就很方便了。
过程十分痛苦,因为对flutter不是很熟悉,对Android原生更是了解很少。所以自己就像突然不能讲话,被丢到一个陌生的环境,却要我去找一个人。所以细心很重要,一定要看清楚错误提示,不要错过每一个细节和可能性。
幸好最后解决了问题,开心~
其实如果你仔细阅读过百度官方的文档,会发现里面有关于 地图的生命周期管理 。然后在这里面没有提及到,这一点虽然没提,但不可或缺,小伙伴就自行思考吧。
最后还有一点,其实我的初衷是想实现一个百度地图的plugin,但是苦于能力有限,对Android的不熟悉,最后折戟。我不得已另起项目,然后重新实现地图sdk接入。经过这次对于这些有更多更全面的认知后,有空会再次研究flutter 插件的开发,共勉,奥利给!!!
售后响应及时
7×24小时客服热线数据备份
更安全、更高效、更稳定价格公道精准
项目经理精准报价不弄虚作假合作无风险
重合同讲信誉,无效全额退款