From 5e2fe3542778afcd11c7b87db4ef341e60db4816 Mon Sep 17 00:00:00 2001 From: Volodymyr Smolianinov Date: Thu, 7 Nov 2024 10:38:12 +0100 Subject: [PATCH] Check homography --- src/index.tsx | 160 ++++++++++++++++++++++++++++ src/operations/check_homography.gql | 69 ++++++++++++ 2 files changed, 229 insertions(+) create mode 100644 src/operations/check_homography.gql diff --git a/src/index.tsx b/src/index.tsx index 63cbd3a..116d21f 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -2734,6 +2734,51 @@ export type GetAggregatedShotMetricsQuery = { }>; }; +export type CheckHomographyIsValidMutationVariables = Exact<{ + b64Image: Scalars["String"]["input"]; + videoId: Scalars["Int"]["input"]; +}>; + +export type CheckHomographyIsValidMutation = { + __typename?: "Mutation"; + checkHomographyIsValid?: { + __typename?: "HomographyInfoGQL"; + frameIndex: number; + crop: { + __typename?: "BoundingBoxGQL"; + left: number; + top: number; + width: number; + height: number; + }; + pockets: Array<{ + __typename?: "BoundingBoxGQL"; + left: number; + top: number; + width: number; + height: number; + }>; + sourcePoints: { + __typename?: "PocketPointsGQL"; + topLeft: { __typename?: "IntPoint2D"; x: number; y: number }; + topSide: { __typename?: "IntPoint2D"; x: number; y: number }; + topRight: { __typename?: "IntPoint2D"; x: number; y: number }; + bottomLeft: { __typename?: "IntPoint2D"; x: number; y: number }; + bottomSide: { __typename?: "IntPoint2D"; x: number; y: number }; + bottomRight: { __typename?: "IntPoint2D"; x: number; y: number }; + }; + destPoints: { + __typename?: "PocketPointsGQL"; + topLeft: { __typename?: "IntPoint2D"; x: number; y: number }; + topSide: { __typename?: "IntPoint2D"; x: number; y: number }; + topRight: { __typename?: "IntPoint2D"; x: number; y: number }; + bottomLeft: { __typename?: "IntPoint2D"; x: number; y: number }; + bottomSide: { __typename?: "IntPoint2D"; x: number; y: number }; + bottomRight: { __typename?: "IntPoint2D"; x: number; y: number }; + }; + } | null; +}; + export type GetDeployedConfigQueryVariables = Exact<{ [key: string]: never }>; export type GetDeployedConfigQuery = { @@ -4269,6 +4314,121 @@ export type GetAggregatedShotMetricsQueryResult = Apollo.QueryResult< GetAggregatedShotMetricsQuery, GetAggregatedShotMetricsQueryVariables >; +export const CheckHomographyIsValidDocument = gql` + mutation checkHomographyIsValid($b64Image: String!, $videoId: Int!) { + checkHomographyIsValid(b64Image: $b64Image, videoId: $videoId) { + frameIndex + crop { + left + top + width + height + } + pockets { + left + top + width + height + } + sourcePoints { + topLeft { + x + y + } + topSide { + x + y + } + topRight { + x + y + } + bottomLeft { + x + y + } + bottomSide { + x + y + } + bottomRight { + x + y + } + } + destPoints { + topLeft { + x + y + } + topSide { + x + y + } + topRight { + x + y + } + bottomLeft { + x + y + } + bottomSide { + x + y + } + bottomRight { + x + y + } + } + } + } +`; +export type CheckHomographyIsValidMutationFn = Apollo.MutationFunction< + CheckHomographyIsValidMutation, + CheckHomographyIsValidMutationVariables +>; + +/** + * __useCheckHomographyIsValidMutation__ + * + * To run a mutation, you first call `useCheckHomographyIsValidMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useCheckHomographyIsValidMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [checkHomographyIsValidMutation, { data, loading, error }] = useCheckHomographyIsValidMutation({ + * variables: { + * b64Image: // value for 'b64Image' + * videoId: // value for 'videoId' + * }, + * }); + */ +export function useCheckHomographyIsValidMutation( + baseOptions?: Apollo.MutationHookOptions< + CheckHomographyIsValidMutation, + CheckHomographyIsValidMutationVariables + >, +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useMutation< + CheckHomographyIsValidMutation, + CheckHomographyIsValidMutationVariables + >(CheckHomographyIsValidDocument, options); +} +export type CheckHomographyIsValidMutationHookResult = ReturnType< + typeof useCheckHomographyIsValidMutation +>; +export type CheckHomographyIsValidMutationResult = + Apollo.MutationResult; +export type CheckHomographyIsValidMutationOptions = Apollo.BaseMutationOptions< + CheckHomographyIsValidMutation, + CheckHomographyIsValidMutationVariables +>; export const GetDeployedConfigDocument = gql` query getDeployedConfig { getDeployedConfig { diff --git a/src/operations/check_homography.gql b/src/operations/check_homography.gql new file mode 100644 index 0000000..b007712 --- /dev/null +++ b/src/operations/check_homography.gql @@ -0,0 +1,69 @@ +mutation checkHomographyIsValid($b64Image: String!, $videoId: Int!) { + checkHomographyIsValid(b64Image: $b64Image, videoId: $videoId) { + frameIndex + crop { + left + top + width + height + } + pockets { + left + top + width + height + } + sourcePoints { + topLeft { + x + y + } + topSide { + x + y + } + topRight { + x + y + } + bottomLeft { + x + y + } + bottomSide { + x + y + } + bottomRight { + x + y + } + } + destPoints { + topLeft { + x + y + } + topSide { + x + y + } + topRight { + x + y + } + bottomLeft { + x + y + } + bottomSide { + x + y + } + bottomRight { + x + y + } + } + } +} -- 2.46.1