/** * Create an image dataset from the flickr gallery, photoset or collection * at the given url. * * @param reader * the reader with which to load the images * @param token * the flickr api authentication token * @param url * the url of the collection/gallery/photo-set * @return a {@link FlickrImageDataset} created from the given url * @throws Exception * if an error occurs */ public static <IMAGE extends Image<?, IMAGE>> FlickrImageDataset<IMAGE> create(InputStreamObjectReader<IMAGE> reader, FlickrAPIToken token, URL url) throws Exception { return create(reader, token, url, 0); }
/** * Create an image dataset from a flickr collection with the specified * parameters. * * @param reader * the reader with which to load the images * @param token * the flickr api authentication token * @param collectionsId * the collections ID * @param userId * the user ID * @return a {@link FlickrImageDataset} created from the gallery described * by the given parameters * @throws Exception * if an error occurs */ public static <IMAGE extends Image<?, IMAGE>> FlickrImageDataset<IMAGE> createFromCollection( InputStreamObjectReader<IMAGE> reader, FlickrAPIToken token, String collectionsId, String userId) throws Exception { return createFromCollection(reader, token, collectionsId, userId, 0); }
private static <IMAGE extends Image<?, IMAGE>> FlickrImageDataset<IMAGE> fromGallery( InputStreamObjectReader<IMAGE> reader, FlickrAPIToken token, String urlString, int number) throws Exception { final Flickr flickr = makeFlickr(token); final Gallery gallery = flickr.getUrlsInterface().lookupGallery(urlString); return createFromGallery(reader, token, gallery, number); }
final int numImages = 20; final FlickrImageDataset<MBFImage> dataset = FlickrImageDataset.create(ImageUtilities.MBFIMAGE_READER, token, "colorful", numImages); dataset.getPhotos().set(1, dataset.getPhoto(0)); features[i] = extractFeature(dataset.get(i)); matrix.setIndexValue(i, dataset.getID(i)); final DoubleFV fi = features[i]; final int idx = dataset.indexOfID(pt.firstObject()); final MBFImage thumb = ImageUtilities.readMBF(new URL(dataset.getPhoto(idx).getThumbnailUrl())); img.drawImage(thumb, pt.getSecondObject().transform(TransformUtilities.scaleMatrix(1000, 1000)));
String collectionId, String userId, int number) throws Exception final Flickr flickr = makeFlickr(token); photos = photos.subList(0, number); return new FlickrImageDataset<IMAGE>(reader, photos);
return fromGallery(reader, token, urlString, number); } else if (PHOTOSET_URL_PATTERN.matcher(urlString).matches()) { return fromPhotoset(reader, token, urlString, number); } else if (COLLECTION_URL_PATTERN.matcher(urlString).matches()) { return fromCollection(reader, token, urlString, number);
/** * Create an image dataset from a flickr gallery with the specified * parameters. * * @param reader * the reader with which to load the images * @param token * the flickr api authentication token * @param galleryId * the Flickr gallery ID. * @return a {@link FlickrImageDataset} created from the gallery described * by the given parameters * @throws Exception * if an error occurs */ public static <IMAGE extends Image<?, IMAGE>> FlickrImageDataset<IMAGE> createFromGallery( InputStreamObjectReader<IMAGE> reader, FlickrAPIToken token, String galleryId) throws Exception { return createFromGallery(reader, token, galleryId, 0); }
/** * Create an image dataset from a flickr photoset. * * @param reader * the reader with which to load the images * @param token * the flickr api authentication token * @param setId * the photoset identifier * @return a {@link FlickrImageDataset} created from the gallery described * by the given parameters * @throws Exception * if an error occurs */ public static <IMAGE extends Image<?, IMAGE>> FlickrImageDataset<IMAGE> createFromPhotoset( InputStreamObjectReader<IMAGE> reader, FlickrAPIToken token, String setId) throws Exception { return createFromPhotoset(reader, token, setId, 0); }
/** * Create an image dataset from a flickr search with the specified * parameters. * * @param reader * the reader with which to load the images * @param token * the flickr api authentication token * @param params * the parameters describing the gallery and any additional * constraints. * @return a {@link FlickrImageDataset} created from the gallery described * by the given parameters * @throws Exception * if an error occurs */ public static <IMAGE extends Image<?, IMAGE>> FlickrImageDataset<IMAGE> createFromSearch( InputStreamObjectReader<IMAGE> reader, FlickrAPIToken token, com.flickr4java.flickr.photos.SearchParameters params) throws Exception { return createFromSearch(reader, token, params, 0); }
final int numImages = 20; final FlickrImageDataset<MBFImage> dataset = FlickrImageDataset.create(ImageUtilities.MBFIMAGE_READER, token, "colorful", numImages); dataset.getPhotos().set(1, dataset.getPhoto(0)); features[i] = extractFeature(dataset.get(i)); matrix.setIndexValue(i, dataset.getID(i)); final DoubleFV fi = features[i]; final int idx = dataset.indexOfID(pt.firstObject()); final MBFImage thumb = ImageUtilities.readMBF(new URL(dataset.getPhoto(idx).getThumbnailUrl())); img.drawImage(thumb, pt.getSecondObject().transform(TransformUtilities.scaleMatrix(1000, 1000)));
String collectionId, String userId, int number) throws Exception final Flickr flickr = makeFlickr(token); photos = photos.subList(0, number); return new FlickrImageDataset<IMAGE>(reader, photos);
return fromGallery(reader, token, urlString, number); } else if (PHOTOSET_URL_PATTERN.matcher(urlString).matches()) { return fromPhotoset(reader, token, urlString, number); } else if (COLLECTION_URL_PATTERN.matcher(urlString).matches()) { return fromCollection(reader, token, urlString, number);
/** * Create an image dataset from a flickr gallery with the specified * parameters. * * @param reader * the reader with which to load the images * @param token * the flickr api authentication token * @param galleryId * the Flickr gallery ID. * @return a {@link FlickrImageDataset} created from the gallery described * by the given parameters * @throws Exception * if an error occurs */ public static <IMAGE extends Image<?, IMAGE>> FlickrImageDataset<IMAGE> createFromGallery( InputStreamObjectReader<IMAGE> reader, FlickrAPIToken token, String galleryId) throws Exception { return createFromGallery(reader, token, galleryId, 0); }
/** * Create an image dataset from a flickr photoset. * * @param reader * the reader with which to load the images * @param token * the flickr api authentication token * @param setId * the photoset identifier * @return a {@link FlickrImageDataset} created from the gallery described * by the given parameters * @throws Exception * if an error occurs */ public static <IMAGE extends Image<?, IMAGE>> FlickrImageDataset<IMAGE> createFromPhotoset( InputStreamObjectReader<IMAGE> reader, FlickrAPIToken token, String setId) throws Exception { return createFromPhotoset(reader, token, setId, 0); }
/** * Create an image dataset from a flickr search with the specified * parameters. * * @param reader * the reader with which to load the images * @param token * the flickr api authentication token * @param params * the parameters describing the gallery and any additional * constraints. * @return a {@link FlickrImageDataset} created from the gallery described * by the given parameters * @throws Exception * if an error occurs */ public static <IMAGE extends Image<?, IMAGE>> FlickrImageDataset<IMAGE> createFromSearch( InputStreamObjectReader<IMAGE> reader, FlickrAPIToken token, com.flickr4java.flickr.photos.SearchParameters params) throws Exception { return createFromSearch(reader, token, params, 0); }
/** * Create an image dataset by searching flickr with the given search terms. * * @param reader * the reader with which to load the images * @param token * the flickr api authentication token * @param searchTerms * the search terms; space separated. Prepending a term with a * "-" means that the term should not appear. * @return a {@link FlickrImageDataset} created from the given url * @throws Exception * if an error occurs */ public static <IMAGE extends Image<?, IMAGE>> FlickrImageDataset<IMAGE> create(InputStreamObjectReader<IMAGE> reader, FlickrAPIToken token, String searchTerms) throws Exception { return create(reader, token, searchTerms, 0); }
String setId, int number) throws Exception final Flickr flickr = makeFlickr(token); photos = photos.subList(0, number); return new FlickrImageDataset<IMAGE>(reader, photos);
private static <IMAGE extends Image<?, IMAGE>> FlickrImageDataset<IMAGE> fromGallery( InputStreamObjectReader<IMAGE> reader, FlickrAPIToken token, String urlString, int number) throws Exception { final Flickr flickr = makeFlickr(token); final Gallery gallery = flickr.getUrlsInterface().lookupGallery(urlString); return createFromGallery(reader, token, gallery, number); }
/** * Create an image dataset from a flickr gallery with the specified * parameters. * * @param reader * the reader with which to load the images * @param token * the flickr api authentication token * @param gallery * the gallery. * @return a {@link FlickrImageDataset} created from the gallery described * by the given parameters * @throws Exception * if an error occurs */ public static <IMAGE extends Image<?, IMAGE>> FlickrImageDataset<IMAGE> createFromGallery( InputStreamObjectReader<IMAGE> reader, FlickrAPIToken token, Gallery gallery) throws Exception { return createFromGallery(reader, token, gallery.getId(), 0); }
/** * Create an image dataset from a flickr collection with the specified * parameters. * * @param reader * the reader with which to load the images * @param token * the flickr api authentication token * @param collectionsId * the collections ID * @param userId * the user ID * @return a {@link FlickrImageDataset} created from the gallery described * by the given parameters * @throws Exception * if an error occurs */ public static <IMAGE extends Image<?, IMAGE>> FlickrImageDataset<IMAGE> createFromCollection( InputStreamObjectReader<IMAGE> reader, FlickrAPIToken token, String collectionsId, String userId) throws Exception { return createFromCollection(reader, token, collectionsId, userId, 0); }