iOS AVFoundation扩展缩小级别

时间:2016-11-24 06:14:44

标签: ios foundation avcapturedevice

我正在使用AVFoundation开发iOS扫描应用。我可以通过调用AVCaptureDevice来设置videoZoomFactor的缩放级别。但问题是最大缩小水平,以便相机可以拍摄A4纸的整张照片是20厘米。我们怎样才能减少这个例如13-14厘米? 无论如何要缩放VideoPreviewLayer

还有什么我们可以把焦点固定在15厘米? (相机只关注固定位置)?

1 个答案:

答案 0 :(得分:1)

您可以使用CoreGraphics直接缩放预览图层。这是示例代码。

create table Songs(Title varchar(75) not null, Artist varchar(40) not null, FeaturedArtist varchar(100), 
Album varchar(100), SongYear YEAR(4) not null, Genre char(10) not null, SubGenre varchar(30), Producer varchar(30) not null, 
SongWriter varchar(50), MusicVideo varchar(30000), Lyrics varchar(30000) not null,
             PRIMARY KEY (Title),
             FOREIGN KEY(Artist) REFERENCES Artist(Artist), 
             FOREIGN KEY(FeaturedArtist) REFERENCES FeaturedArtists(Artist), 
             FOREIGN KEY(Album) REFERENCES Albums(Album), 
             FOREIGN KEY(Genre) REFERENCES Genre(Genre), 
             FOREIGN KEY(SubGenre) REFERENCES SubGenre(SubGenre));

create table Artists(Artist varchar(40) not null, Genre varchar(10) not null, Band_Group varchar(40),  
             PRIMARY KEY(Artist),
             FOREIGN KEY Genre REFERENCES Genre(Genre));

create table Genre(Genre varchar(10) not null, RelatedGenres varchar(10) not null); PRIMARY KEY(Genre);
FOREIGN KEY RelatedGenres REFERENCES RalatedGenres(Genre);

create table RelatedGenres(Genre varchar(10) not null, RelatedGenre varchar(10));

create table SubGenre(SubGenre varchar(30) not null, Genre varchar(10) not null,
             PRIMARY KEY(SubGenre),
             FOREIGN KEY(Genre) REFERENCES Genre(Genre));

要修复焦点,您可以使用// zoom the preview view using core graphics [previewView setTransform:CGAffineTransformMakeScale(2.0, 2.0 )];

下的属性
AVCaptureDevice

请注意,焦点感兴趣值(0,0)表示相机应该对焦于图像的左上角,而值(1,1)表示它应该对焦于右下角。默认值为(0.5,0.5)