Sunday, March 16, 2014

Simple plan for Barcelona visit - Day B - Eixample / Gaudi

For this B day, we will be in the area of Barcelona called the Example and also a bit further towards the mountain. Please see here for other locations in Barcelona. Except for Parc Guell, the other locations are buildings, so, ok to visit during bad weather... Nevertheless, Sagrada Familia may close the visit to the tower (just to the tower) in that case... Also, they are nice at night (but open only during day time...):
  1. Sagrada Familia: this is one of the most emblematic icons of the city. You can buy the tickets on-line. Not sure if that will save you the line outside but I heard that although long, it is not too bad... Unless you are in a tight budget, I do think it is worth to go in. Go up in the tower is nice too. I can talk hours about this place, but to save you that, I would strongly recommend you to read the Wikipedia article to get a good background. Nice article about the towers and which one to visit.
  2. Pedrera and Casa Batllo: walking distance from Sagrada Familia (see the black line in the map below). Famous spots of the city too, feel free to go in if your budget/time allows.
  3. To get to Park Guell, another must-see place, I usually take subway green line (L3) to Vallcarca station. The line kind of goes along the mountain/sea axis for a while, down Gracia and Ramblas, so, you can take it from any station there (Passeig de Gracia, Catalunya, Liceu, Drassanes...). Once you get to Vallcarca walk a bit along Vallcarca Avenue, sea direction, till you hit Baixada de la Gloria, on your left (red line in the map). It is a street full of mechanical scalators (feel free to walk too :) ) that will take you to the South side of the Park. I feel that is more interesting than getting a taxi up there, but hey... Unfortunately, the city started charging to enter on the park around 2016 (can't remember, but used to be free) but you can get there earlier or later than the running hours and see it for free. In the morning you can see the sun raise (assuming you can wake up in time :) ), so, it is much better than in the evening, when it may get dark depending on the time of the year and you can't see anything in the park (no lights).

Check the map here

Safe travels!!

Saturday, March 15, 2014

Simple plans to visit Barcelona

Few friends asked me about what to do/go in Barcelona, so, here is a summary of some stuff... I broke it by days, so, it makes it easier to plan things...

Note: I hate to start by this, but watch with the pickpockets... Few friends of mine got stolen their wallet or purse, so... Other than that, I would consider Barcelona to be very safe.

For a 3 days trip I would think something like this (sorry not finished, I'll add later). Order of days does not matter. Probably plan according to weather forecast :)
But if you have 2, it gets tougher. So, here is one potential thought:
  1. Day 1: Sagrada Familia (day B above) / Park Guell (day B above)
  2. Day 2: Day C above.
  3. On whatever time after hours/night you have, you can see the outside of Pedrera and Casa Batllo (day B above) and the Magic Fountains (day A above).
Cheers!
PS.: Sorry that I can't include everything, as Barcelona is full of stuff to see and do. If you want more info, these are some quick sites I found:

Simple plan for Barcelona visit - Day A - Montjuic Area

Please see here for overall index for other areas of town.

Note 1: The order you do this is a bit up to you. If you got your hotel close to this area, you can just do this anytime. But if not, you may want to plan to finish at night and stop by the Magic Fountains.
Note 2: times indicate my guess on how much somebody would spend there...
Note 3: click on the map below and a Google Maps route should open up.
  • Spanish Square (Plaza de España / Plaça d'Espanya). Subway stop, red line (#1). Head towards the two towers you see there, which mark the Fira (trade fair) entrance and the path to the mountain (most of the stuff to see in the area...).
  • Las Arenas: in the Spanish Square (actually, one exit of the subway is there), it is a bullfighting ring remodeled into a mall. You can go to the roof top (for free if you do it from inside the mall) and enjoy the views, food, etc... or the shopping, if you like :). Maybe something to do when you want to take a break.
  • Olympic ring: 1-2hr Take a stroll around... There are mechanical stairs up to here, from Plaza España:
    • Estadio Olimpico. Check the cauldron where this happened
    • Estadio de Sant Jordi - Basketball
    • Torre de Calatrava - I like this one
  • Castillo de Montjuic (a castle to city and sea views): you can walk to here or take a lift - 1hr
  • Poble Espanyol: a display of other regions in Spain.
  • Diving Pools (Piscinas de salto) : Where during the Olympics you could see this beautiful background. I believe now most of the time they are close so you can only see from the fence...
  • Greek Theater Gardens - 30 min
  • Magic Fountains: A must see, at night. - 1hr... till you get tired. Show/music changes along the night... I copy schedule below in case the link gets broken but it may get out of date (so, better to Google it). Notice that during most of the year, they only run them from Th. through Saturday, so, plan a visit to this area in that time of the week...
    • Operating hours from 30th April to 30th September:
      • Thursday to Sunday, 9pm – 11:30pm
      • Musical displays: 9pm, 9:30pm, 10pm, 10:30pm and 11pm
    • Operating hours from 1st October to 30th April:
      • Fridays and Saturdays, 7pm – 9pm
      • Christmas and Easter:
      • Thursday to Sunday, 7pm – 9pm
      • Musical displays: 7pm, 7:30pm, 8pm and 8:30pm
  • B-Hotel: I am not endorsing this hotel by no means and I make no money with this site... Do your research. But some friends of mine were there and liked it, specially the rooftop pool! Truth is that no one has so far complained about their hotel, wherever they stayed. 
  • There are many other things to do and see in the area: Miro Museum and many others (see the links on the right side of this page)


View Montjuic route in a larger map

Hope you enjoy!!

Thursday, March 6, 2014

Recovering an edited email file attachment

My life just went by my eyes... I had been working the whole day adding notes and corrections to a pdf file. A work that I actually hate and I was looking fwd to finish. I was clicking save while not realizing that I had not made a copy to disk. Was not getting any errors, though... Then I close it and hit me (with scenes of my infancy, chills, and thoughts of how stupid I can be). Well, if you are here, probably you have the same symptoms.

I have to say that I was lucky and found this
Bottom line, the file is in your Internet file folder but it will not show with search. Follow the link to find it.

Cheers! Now you can continue with your life :)

Tuesday, February 25, 2014

Virtual Desktop on Windows 7

Just for my reference... See this article
I decided to install VirtuaWin and so far so good. Was easy to install and operate.
Some people thought this one was very lightweight and easy but haven't tried it.

Thursday, January 30, 2014

Engineering quotes that I agree with...

“The path to the CEO's office should not be through the CFO's office, and it should not be through the marketing department. It needs to be through engineering and design.”
-- Elon Musk, CEO and chief product architect, Tesla Motors

“The worst thing in the world that can happen to you if you’re an engineer that has given life to something is for someone to rip it off and put their name on it.”
-- Tim Cook, CEO of Apple Inc.

“So here we have pi squared, which an engineer would call 10.”
-- Frank King, cartoonist, creator of Gasoline Alley

“You go to a technology conference or an engineering conference, there are very few women there. At the same time, it’s a blessing in the fact that you do get noticed. People tend to remember you as the only woman in the room ‘who said that’ or the only woman in the room who was an engineer.”
-- Padmasree Warrior, CTO of Cisco Systems, former CTO of Motorola Inc.

“Let’s face it: Engineering companies in general have more men than women. Google has tried really hard to recruit women. On the other hand, we have a standard. Google tries to recruit the best engineers.”
-- Susan Wojcicki, senior vice president in charge of product management and engineering at Google

Source: got these from many others in the following link.

Few more:
"I do not know one millionth part of one percent about anything"
-- Thomas Edison
I do not know one millionth part of one percent about anything - Thomas Edison - See more at: http://www.youcaring.com/medical-fundraiser/team-isaac-/82832#sthash.dgvEZBq8.dpuf
I do not know one millionth part of one percent about anything - Thomas Edison - See more at: http://www.youcaring.com/medical-fundraiser/team-isaac-/82832#sthash.dgvEZBq8.dpuf
I do not know one millionth part of one percent about anything - Thomas Edison - See more at: http://www.youcaring.com/medical-fundraiser/team-isaac-/82832#sthash.dgvEZBq8.dpuf


Saturday, January 25, 2014

Detect faces with Android SDK, no OpenCV

By now, we have tackled this in many ways :). Usually with OpenCV. See a list of posts here...
Now we are going to basically take this post, where we detected the faces with OpenCV in Android, and replace the face detection portion (CascadeClassifier + detectMultiScale) and replace it for FaceDetector.findFaces method in Android SDK. So, everything else is the same as that post, only thing is that we need to:
  1. Convert Mat to Bitmap on the right format for the face detection method (RGB_565).
  2. Do the face detection with the Android SDK.
We also reduce the original image resolution so that the detection happens much faster, as we did in the original post. So, although I copy here all the code so you don't have to go back and forth, the part changing is what goes after VIEW_MODE_GRAY inside the "public Mat onCameraFrame(CvCameraViewFrame inputFrame)" method. Notice that we still use all the framework from OpenCV to capture and display the image, and not the Android SDK approach.

Note: it seems that the FaceDetector used here is not the one my built-in camera app is using. I know this from simple performance evaluation. For instance, if I rotate the camera, the camera app still detects my face but FaceDetector loses it. It seems that there is one more way in the SDK to detect faces starting from Android 4.0 which I have not tried (so, don't now its performance). Still, probably that is not what is used in the camera app. This post here points to the same and has no answer, in case anybody wants to get some StackOverflow points :). I agree though that using the built-in camera app would likely narrow my software down to my phone.

_3DActivity.java
 /*  
  * Working demo of face detection (remember to put the camera in horizontal)  
  * using OpenCV/CascadeClassifier.  
  * Posted in http://cell0907.blogspot.com/2014/01/detecting-faces-in-android-with-opencv.html  
  */  
 package com.cell0907.td1;  
 import org.opencv.android.BaseLoaderCallback;  
 import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame;  
 import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2;  
 import org.opencv.android.LoaderCallbackInterface;  
 import org.opencv.android.OpenCVLoader;  
 import org.opencv.android.Utils;  
 import org.opencv.core.Core;  
 import org.opencv.core.CvException;  
 import org.opencv.core.CvType;  
 import org.opencv.core.Mat;  
 import org.opencv.core.Scalar;  
 import org.opencv.core.Size;  
 import org.opencv.imgproc.Imgproc;  
 import org.opencv.core.Point;  
 import android.app.Activity;  
 import android.graphics.Bitmap;  
 import android.graphics.PointF;  
 import android.media.FaceDetector;  
 import android.media.FaceDetector.Face;  
 import android.os.Bundle;  
 import android.util.Log;  
 import android.view.Menu;  
 import android.view.MenuItem;  
 import android.view.SurfaceView;  
 import android.view.WindowManager;  
 public class _3DActivity extends Activity implements CvCameraViewListener2 {  
   private static final int         VIEW_MODE_CAMERA  = 0;  
   private static final int         VIEW_MODE_GRAY   = 1;  
   private static final int         VIEW_MODE_FACES  = 2;  
   private MenuItem             mItemPreviewRGBA;  
   private MenuItem             mItemPreviewGrey;  
   private MenuItem             mItemPreviewFaces;  
   private int               mViewMode;  
   private Mat               mRgba;  
   private Mat               mGrey;  
   private int                              screen_w, screen_h;  
   private Tutorial3View            mOpenCvCameraView;   
   private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {  
     @Override  
     public void onManagerConnected(int status) {  
       switch (status) {  
         case LoaderCallbackInterface.SUCCESS:  
         {  
           // Load native library after(!) OpenCV initialization  
           mOpenCvCameraView.enableView();        
         } break;  
         default:  
         {  
           super.onManagerConnected(status);  
         } break;  
       }  
     }  
   };  
   public _3DActivity() {  
   }  
   /** Called when the activity is first created. */  
   @Override  
   public void onCreate(Bundle savedInstanceState) {  
     super.onCreate(savedInstanceState);  
     getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);  
     setContentView(R.layout.tutorial2_surface_view);  
     mOpenCvCameraView = (Tutorial3View) findViewById(R.id.tutorial2_activity_surface_view);  
     mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);  
     mOpenCvCameraView.setCvCameraViewListener(this);  
   }  
   @Override  
   public void onPause()  
   {  
     super.onPause();  
     if (mOpenCvCameraView != null)  
       mOpenCvCameraView.disableView();  
   }  
   @Override  
   public void onResume()  
   {  
     super.onResume();  
     OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);  
   }  
   public void onDestroy() {  
     super.onDestroy();  
     if (mOpenCvCameraView != null)  
       mOpenCvCameraView.disableView();  
   }  
   public void onCameraViewStarted(int width, int height) {  
        screen_w=width;  
        screen_h=height;  
     mRgba = new Mat(screen_w, screen_h, CvType.CV_8UC4);  
     mGrey = new Mat(screen_w, screen_h, CvType.CV_8UC1);  
     Log.v("MyActivity","Height: "+height+" Width: "+width);  
   }  
   public void onCameraViewStopped() {  
     mRgba.release();  
     mGrey.release();  
   }  
   public Mat onCameraFrame(CvCameraViewFrame inputFrame) {  
        long startTime = System.nanoTime();  
        long endTime;  
        boolean show=true;  
        mRgba=inputFrame.rgba();  
        if (mViewMode==VIEW_MODE_CAMERA) {  
             endTime = System.nanoTime();  
          if (show==true) Log.v("MyActivity","Elapsed time: "+ (float)(endTime - startTime)/1000000+"ms");  
             return mRgba;  
        }     
        if (mViewMode==VIEW_MODE_GRAY){  
          Imgproc.cvtColor( mRgba, mGrey, Imgproc.COLOR_BGR2GRAY);           
          endTime = System.nanoTime();  
          if (show==true) Log.v("MyActivity","Elapsed time: "+ (float)(endTime - startTime)/1000000+"ms");  
             return mGrey;  
        }  
        // REDUCE THE RESOLUTION TO EXPEDITE THINGS  
        Mat low_res = new Mat(screen_w, screen_h, CvType.CV_8UC4);  
        Imgproc.resize(mRgba,low_res,new Size(),0.25,0.25,Imgproc.INTER_LINEAR);  
        Bitmap bmp = null;  
        try {  
          bmp = Bitmap.createBitmap(low_res.width(), low_res.height(), Bitmap.Config.RGB_565);  
          Utils.matToBitmap(low_res, bmp);  
        }  
        catch (CvException e){Log.v("MyActivity",e.getMessage());}  
           int maxNumFaces = 1; // Set this to whatever you want  
           FaceDetector fd = new FaceDetector((int)(screen_w/4),(int)(screen_h/4),  
                  maxNumFaces);  
           Face[] faces = new Face[maxNumFaces];  
           try {  
                  int numFacesFound = fd.findFaces(bmp, faces);  
                  if (numFacesFound<maxNumFaces) maxNumFaces=numFacesFound;  
                  for (int i = 0; i < maxNumFaces; ++i) {  
                       Face face = faces[i];  
                       PointF MidPoint = new PointF();  
                 face.getMidPoint(MidPoint);  
 /*                      Log.v("MyActivity","Face " + i + " found with " + face.confidence() + " confidence!");  
                       Log.v("MyActivity","Face " + i + " eye distance " + face.eyesDistance());  
                       Log.v("MyActivity","Face " + i + " midpoint (between eyes) " + MidPoint);*/  
                       Point center= new Point(4*MidPoint.x, 4*MidPoint.y);  
                       Core.ellipse( mRgba, new Point(center.x,center.y), new Size(8*face.eyesDistance(), 8*face.eyesDistance()), 0, 0, 360, new Scalar( 255, 0, 255 ), 4, 8, 0 );  
                  }  
             } catch (IllegalArgumentException e) {  
                  // From Docs:  
                  // if the Bitmap dimensions don't match the dimensions defined at initialization   
                  // or the given array is not sized equal to the maxFaces value defined at   
                  // initialization  
                  Log.v("MyActivity","Argument dimensions wrong");  
             }  
           if (mViewMode==VIEW_MODE_FACES) {  
                endTime = System.nanoTime();  
                if (show==true) Log.v("MyActivity","Elapsed time: "+ (float)(endTime - startTime)/1000000+"ms");  
             return mRgba;  
                //return low_res;  
        }          
           return mRgba;  
    }  
   @Override  
   public boolean onCreateOptionsMenu(Menu menu) {  
     mItemPreviewRGBA = menu.add("RGBA");  
     mItemPreviewGrey = menu.add("Grey");  
     mItemPreviewFaces = menu.add("Faces");  
     return true;  
   }  
   public boolean onOptionsItemSelected(MenuItem item) {  
     if (item == mItemPreviewRGBA) {  
       mViewMode = VIEW_MODE_CAMERA;  
     } else if (item == mItemPreviewGrey) {  
       mViewMode = VIEW_MODE_GRAY;  
     } else if (item == mItemPreviewFaces) {  
       mViewMode = VIEW_MODE_FACES;  
     }  
     return true;  
   }    
 }  

For the rest of the files, please check the original post.

Just a final note... Somebody may wonder why I am mixing OpenCV with face detection from Android SDK. I am using OpenCV because it allows me to display something completely unrelated to what the camera is capturing (I need that for my final app). Although I found a method to do that without OpenCV I think it doesn't work with all the devices out there. And I use the face detection from Android SDK because I think it is more robust and still works, for instance, when turning the head... The weird thing is that it doesn't seem to work as good as the one I get on my camera app (the one that comes from factory with my phone, and HTC One). I also thought it would be faster, but actually looks slower...

PS.: Reference I used...