Community

RTR Device Orientation

Здравствуйте! Как настроить распознавание в лендскейп ориентации? В докуметации и примере этого не предусмотрено. Выдает Search region is invalid при переворачивании. Прошу помощи.

Was this article helpful?

0 out of 0 found this helpful

Comments

4 comments

  • Avatar
    Anna Savinova

    Обратите внимание на посты: is Orientation other than Portrain supported in AbbyyRtrSDK? и Android sample app crashes when changing from portrait to landscape. Данный вопрос уже ранее обсуждался там. 

    0
  • Avatar
    Игорь Войтович

    Спасибо за ответ! Эти посты видел. "you’ll need to restart the service with changed orientation" - что под этим подразумевается? Что конкретно нужно сделать после смены ориентации?

    0
  • Avatar
    Anna Savinova

    Необходимо в настройках проекта включить Device Orientation > Landscape Left и Landscape Right, а также добавить в код метод для трансляции координат:

    - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
    {
    	[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
    
    	BOOL wasRunning = self.isRunning;
    	self.running = NO;
    	[_textCaptureService stopTasks];
    	[self clearScreenFromRegions];
    
    	[coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context)
    	{
    		_imageBufferSize = CGSizeMake(MIN(_imageBufferSize.width, _imageBufferSize.height),
    			MAX(_imageBufferSize.width, _imageBufferSize.height));
    		if(UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
    			_imageBufferSize = CGSizeMake(_imageBufferSize.height, _imageBufferSize.width);
    		}
    
    		[self updateAreaOfInterest];
    		self.running = wasRunning;
    	}];
    }

    В ближайшую неделю появится новая версия Real-Time Recognition SDK, включающая в себя уже дополненный пример, поддерживающий данную функциональность.

    0
  • Avatar
    Oksana Serdyuk

    In English:
    If you want your application works with landscape orientation, you need to enable Device Orientation > Landscape Left and Landscape Right in your project, and implement the method for translating coordinates:

    - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
    {
        [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];

        BOOL wasRunning = self.isRunning;
        self.running = NO;
        [_textCaptureService stopTasks];
        [self clearScreenFromRegions];

        [coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context)
        {
            _imageBufferSize = CGSizeMake(MIN(_imageBufferSize.width, _imageBufferSize.height),
                MAX(_imageBufferSize.width, _imageBufferSize.height));
            if(UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation)) {
                _imageBufferSize = CGSizeMake(_imageBufferSize.height, _imageBufferSize.width);
            }

            [self updateAreaOfInterest];
            self.running = wasRunning;
        }];
    }

    Beginning from the RTR SDK 1 Release 5 with extended Data Capture (the build number 1.0.7.56) our code samples support of landscape mode.

    0

Please sign in to leave a comment.